Hi A,Do you have a simulator software? Say, proteus? It's better you run or simulate the program in proteus first so you would know your program is working.
Write a program that will simply flash the LED, say twice, by sending a 1 to the port pin where the LED is connected, then a delay of 500ms, and then send a 0, a delay of 500ms, send a 1, a delay, and a 0. This will flash the LED twice in 2 seconds.
So, try it in proteus. If the simulation works, you are almost there. Burn the program to PIC, and turn in on. If the LED won't flash, then there is a problem with your hardware. Probably a loose crystal, a loose connection to ground and source pins, or the LED is reverse-biased (working connection) or the limiting resistor for the LED is very large. Better to use green LED because its forward voltage is high, thus you may omit its limiting resistor. It won't get busted especially that it is simply flashing, it won't heat up.
Hi T,One of the common mistakes I used to keep on making with PICs is that I forgot that some of the digital output pins will default to analogue inputs.
So I would check that you've disabled all analogue functions first of all.
Which PIC is it?
Oh, and what are the I/O pins you're using?
And finally, have you set up a clock?
To add to @be80beHi,
What I was wondering is, if the PIC programs and verifies, does this prove it's working?
Is it possible that the PIC program is working, but the PORTs aren't?
C
Hi J,With MPLab SIM, oscillator settings don't matter. Only with a hardware simulator (e.g., MPLab ICD3 or PicKit 3) will you catch an error in the oscillator module. Are you using actual hardware simulation with Oschonsoft?
Hi B,When you program a pic all that happens is your programmer writes the chips memory it then reads it back to see if it has the
same data. That doesn't mean your code is right and will run as you think.
You more then likely have the fuse wrong or the port settings wrong. The fuse setting are the first place I check.
Oschonsoft has great sim to check port settings to see if there right but it really don't care much about fuse setting it will sim the reg setting fine tho.
Hi J,To add to @be80be
Be sure MCLR/ is pulled up or disabled in the Configuration Bits then, a quick go/no go would be to add a pullup resistor to one of the PORT C pins then add
LATC = 0
TRISC = 0
to the beginning of your code and use a DVM on that pin. If it goes to 0 volts (or close to it) when you power up, the PIC is running (PORTC is a digital input on power up and the code must execute to output a 0).
If you are using the internal oscillator, specify to output the oscillator on RA6 in the Configuration Bit settings (INTIO1) then inspect that pin. If the oscillator is running, the voltage should be about 1/2 Vdd on a DVM (you can scope it if you have one). If the pin is Vss or Vdd, the oscillator isn't running.
Once the PIC is running its up to the code to make your LEDs flash. Be sure to visit each port description in the databook to know when you have to configure the pin to be digital. See ANSEL0 and ANSEL1 descriptions.
Finally, be sure you always write or toggle to LATx not PORTx to avoid r-m-w issues.
Good luck!
Hi T,Your configuration bits:
CONFIG1L has no useful bits (you've described it as 'INTOSC', but this is actually in CONFIG1H
CONFIG1H looks okay
CONFIG2L you've set it to 0b00001110 - bits 2:3 are '11', which is 'Reserved' according to the datasheet (this is for the brown-out voltage level)
CONFIG2H is actually the watchdog configuration, and not the power up timeout
And I'm stopping at this point, because it seems that either I've got the wrong datasheet, or you have - this is what I'm using:
http://ww1.microchip.com/downloads/en/DeviceDoc/39616d.pdf
It's possible that there's an errata, but it seems like there is a massive discrepancy.
Hi I,Hi C!!
Are you running this on a real pic for the first time???? If your code has the "simulation_waitms_value" set Your code may be running far too fast... It will be tripping itself up!!
Other than that as Sensacell mentioned... Config bits not matching hardware used...
Hi E,hi C,
As I have suggested previously, with Oshonsoft it is so easy to add an Hseropen, and Hserout [ that output say "Ready"] or an other program sequence check marker tags/information.
E
Hmm - the '2431 should have the same configuration bits as the '4431...Hi T,
From experience, any problems will be at my end
I simply copied and pasted the configuration settings from an earlier 18LF2431 program I have working, which isn't really what should be done.
C.
by Aaron Carman
by Jake Hertz
by Duane Benson
by Jake Hertz