Re: Troubles with PIC 16F88




"Brian KP" <briankpeterson@xxxxxxxxx> schreef in bericht
news:1133489597.919066.44090@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I have been trying to program an 18pin 16F88 for a project, my first
> attempt at using PIC chips. So far I haven't been able to get an LED to
> blink. I have this PIC-PG2C programmer:
> http://www.olimex.com/dev/pic-pg2c.html and am using the ICProg program
> the manufacturer said is compatible. I am currently using CCS C
> compiler that I received from a friend who has worked with PICs
> before, but haven't figured how to use CCS from within MPLAB and
> currently just double click the executable in its directory and it asks
> for the location of the source code and spits out a hex file. I have
> the 16F88.h file in the same directory, and CCS C reports no errors.
>
> I am just powering the PIC with +5V and Ground, someone also told me I
> might need to feed pin 4 high, or low, to keep the device from
> continuously resetting. Is that correct?
> I don't have an external RC attached and wish to use the internal
> clock, I set the ICProg configuration to "IntRC". The programmer
> programs and then verifies the programming, yet when I put the chip
> into a circuit with +5 on pin 14, ground on pin 5, and an LED between
> pin 17 and ground; the LED has a barely detectable blink to it, but
> when I connect pin 4 to +5 the LED remains on solid, and when I connect
> pin 4 to ground the LED turns off completely. Here is a link to the
> 16F88 data sheet:http://www.robotstore.com/download/247097.pdf
>
> I assume CCS C is a good compiler, but is there another one anyone
> would suggest?
>
> Here is my source code:
> #include <16F88.h>
> #fuses HS,NOWDT,NOPROTECT,NOLVP
> #use delay(clock=4000000)
> // Wait for one second
> void wait() {
> int count = 0;
> while(count < 100000) {
> delay_us(10);
> count = count + 1;
> }
> }
> // Blink the PIN
> void blink() {
> output_high(PIN_A0);
> wait();
> output_low(PIN_A0);
> wait();
> }
> void main() {
> while(TRUE) {
> blink();
> }
> }
>
> I have also read about PIC simulators, has anyone used one and can
> recommend it? My project involves gathering data from two to three
> voltage imputs (carbon di/monoxide detectors) and converting those
> voltages to ppm and outputing the values to an LCD display. Then
> calculating and storing or displaying the average over certain time
> spans. One step at a time though.
>

Hmm... according to your source the oscillator is set to HS instead of
INTOSC. I see no trace of configuring pin 17 for output. When using a common
red LED I'd advise to use a series resistor of let's say 330 Ohm. Can't you
tell the compiler to output assembler code so you can see what it has done?
(And show us as well.) Once you have the code in assembler you can also use
the MPLABs simulator to see your program execute.

petrus bitbyter


.



Relevant Pages

  • Troubles with PIC 16F88
    ... attempt at using PIC chips. ... I am currently using CCS C ... might need to feed pin 4 high, or low, to keep the device from ... the LED has a barely detectable blink to it, ...
    (sci.electronics.design)
  • Re: Troubles with PIC 16F88
    ... I have this PIC-PG2C programmer: ... I am currently using CCS C ... >might need to feed pin 4 high, or low, to keep the device from ... the LED has a barely detectable blink to it, ...
    (sci.electronics.design)
  • Re: ccs compiler with pic12ce674?
    ... > Has anyone used the CCS C compiler with the PIC12CE674? ... I also tried setting the oscillator mode to internal oscillator ... The GP3 pin is equivalent to an open collector output (technically ... I've had problems with CCS IO setup functions in the past. ...
    (comp.arch.embedded)
  • Now a dead MPU? What to do? Had this pin only 2 weeks.
    ... OK, my Spy Hunter pin. ... Luckily I just read earlier today about an mpu test while reading my ... blink 6 more times. ... So far I just checked all the fuses, ...
    (rec.games.pinball)
  • Re: web query w/login and password
    ... You can usually find the "item names" by viewing the source code for ... because I don't have a valid PIN. ... me to a page that asks for a valid SSN and PIN. ...
    (microsoft.public.excel.programming)