CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Port pin does not work on Pic16F88
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

Port pin does not work on Pic16F88
PostPosted: Wed Aug 16, 2017 1:54 pm     Reply with quote

Dear Friends,

I wrote a program and when I uploaded to the PIC16F88, some outputs did not work. I tried the raw sample program of just blinking LED and noticed that on Port B bit 3 the Led does not blink. why?

I am using PIC16F88, crystal 20MHz.
Code:

#include <trial_ebayboard.h>

void main()
{
   set_tris_b(0x00);
   //Example blinking LED program
   while(true)
   {
      output_low(PIN_B3);
      delay_ms(DELAY);
      output_high(PIN_B3);
      delay_ms(DELAY);
   }

}


Than when I try PIN_B7 and PIN_B6 it works fine. Is there something I am missing? Just to let you know that I also tried the same program on proteus and it work correctly. I know that some of you do not agree on Proteus but this might be a clue.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 2:02 pm     Reply with quote

You don't show us your fuses.

You almost certainly have LVP enabled. This uses pin B3.
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 2:04 pm     Reply with quote

this is the fuses:

Code:
#include <16F88.h>
#device ADC=16

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O

#use delay(crystal=20000000)

#define LED PIN_B3
#define DELAY 1000


Last edited by aaronik19 on Wed Aug 16, 2017 2:13 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 2:20 pm     Reply with quote

Quote:
#include <trial_ebayboard.h>

Post a link to the Ebay page for your board.
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 2:23 pm     Reply with quote

what ebay link??
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 2:31 pm     Reply with quote

Your post has a file called "ebay board". I assume you bought a
development board from ebay. Just an assumption.
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 2:32 pm     Reply with quote

yes to identify the program. Just a name
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 16, 2017 3:57 pm     Reply with quote

I wonder if the LVP fuse is really being disabled.

1. Temporarily remove the LED circuit from pin B3.
2. Add a 10K pull-down resistor on pin B3. That's 10K to ground.
3. Program the PIC with the #fuses set to NOLVP.
4. Remove the pull-down resistor and re-connect your LED circuit.
5. Test and see if the LED now blinks properly.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 12:41 am     Reply with quote

Let's ask the other question.

What compiler version number please?.
Then we can test and see if this pin is being setup correctly.

There are a sequence of things in order:

1) LVP. Could include things like the board being designed to use LVP, so the pin has a jumper or something to short it low when not being used for programming. Hence the request to see the board involved.
2) A hardware problem with the board. Includes the above, but covers things like solder whiskers etc..
3) A problem with a particular compiler version, or your programmer.
4) Loads of other things...

One thought, from '3' is that you might have your programmer not setup to actually write the configuration fuses. LVP is the default.
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 12:29 pm     Reply with quote

Dear All,

I am using compiler 5.015 and the programmer is the PICKit2.
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 1:03 pm     Reply with quote

and what software are you using to control the programmer?.

Look if it has a setting to control whether it writes the configuration words?.
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 1:09 pm     Reply with quote

this....

#include <trial_ebayboard.h>

should have it's contents posted.

Header file contents are unknown to us,even Google came up short!

You should also post a 'link' to the PCB you bought which has to have pinout, specs, schematic, etc.

I've used the PICKit3 to program the 16F88 years ago with no problems but nothing says you couldn't have a hardware issue( ie. solder wisk, open) though I suspect software( incorrect fuses).

Jay
aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 1:22 pm     Reply with quote

this is the setting in the image below:

aaronik19



Joined: 25 Apr 2011
Posts: 297

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 1:38 pm     Reply with quote

the circuit is below:

Nothing special

https://ibb.co/cWWrWa
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Thu Aug 17, 2017 2:57 pm     Reply with quote

I've just taken the code assembled from what has been posted:
Code:

#include <16F88.h>
#device ADC=16

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O

#use delay(crystal=16MHz)

#define LED PIN_B3
#define DELAY 1000

void main()
{
   set_tris_b(0x00);
   //Example blinking LED program
   while(true)
   {
      output_low(PIN_B3);
      delay_ms(DELAY);
      output_high(PIN_B3);
      delay_ms(DELAY);
   }
}

Compiled with 5.015. Programmed (with Mach-X), and put it into a F88, on a bare breadboard (direct 5v supply from a bench supply, with a couple of extra 0.1uF capacitors by the chip pins), MCLR pullup. Used a 16Mhz crystal, since I did not have a 20MHz unit).
It is merrily toggling the pin...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group