SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
User avatar
By redteardrop
#46462
I can't seem to get my chips to work. I'm just using a test LED and blink code. This is my circuit and code:
Image
Code: Select all
HIGH PORTD.1    
loop:   
   High 0          ' Turn on LED connected to PORTB.0
   Pause 500       ' Delay for .5 seconds
   Low 0           ' Turn off LED connected to PORTB.0
   Pause 500       ' Delay for .5 seconds
   Goto loop       ' Go back to loop and blink LED forever
   End
No matter what pin (except MCLR and VDD) the LED won't light up. I know the LED works, I know the chip is getting power, and I know the MCLR res is 10k. I also verified the code on the chip after I tried it in the circuit to see if the circuit was erasing the chip, but it verified fine.

Please let me know what might be the problem. I can't seem to see it.
thanks.
Ps. here is the hex for my blink code (put in text file and save with .hex extention to test)
Code: Select all
:020000040000FA
:1000000028EF00F0046A036EFF0E0326D8A0042632
:10001000D8A025EF00F0030E026EDF0E02D8F4D751
:10002000026AE80F016E021EFC0ED8A003D0012662
:10003000D8B0FDD701260400023EF9D701B000D0A8
:1000400001A202D0000000D0120000010400120042
:100050008382959281809390010E046EF40ED3DF1B
:1000600081909390010E046EF40ECDDFF3D7030060
:02007000FED7B9
:020000040030CA
:04000000FFF9FFFF06
:02000600FBFFFE
:00000001FF
I'm using picBasic Pro, IC-Prog to program on a PG2C. I haven't had any problems before using winPic to program, but it was giving me some problems lately so I switched over.
I was also trying to test with a 16f648a on port A and B with no luck either.
:cry: :cry: :cry:
By saipan59
#46470
Also, you should connect pins 31 and 32 to the appropriate places.

Pete
By saipan59
#46471
Also, depending on the CONFIG settings for this particular PIC, you may need to tie pin 38 high through a pullup.

Pete
By emf
#46473
I don't think the 18F452 has an internal oscillator, so you'd need some sort of clock source (crystal & capacitors, ceramic resonator, etc) connected on pins 13 & 14 for it to do anything. I think the 16F648a has an internal oscillator, so it should work if you have that configured correctly.
By saipan59
#46476
Ah, good catch!
No INTOSC on those parts...

Pete
User avatar
By redteardrop
#46495
ok, here is my new code:
Code: Select all
define osc 20
TRISB = 0
TRISC = 0
TRISD = 0
TRISE = 0
output portB
output portC
output portD
output portE

HIGH PORTB
HIGH PORTC
loop:   
   High portD.2          ' Turn on LED connected to PORTD.2
   Pause 500       ' Delay for .5 seconds
   Low portD.2           ' Turn off LED connected to PORTD.2
   Pause 500       ' Delay for .5 seconds
   Goto loop       ' Go back to loop and blink LED forever
   End
So that defines an output.
I also defined an OSC and am using a 20mHz with 20pf caps.
I also added the power and ground on 31 & 32 which shouldn't have been a problem with short code and low power requirement.
I've never had to pull up 38 before.
The 18f452 should have a 4mHz int osc, but I tried the 20 I have just in case.


I think the problem might actually be on my computer. I used to use win-Pic and it worked great, but after I reformatted my hard drive and reinstalled everything it doesn't seem to give me the same options. It should look like this:
Image
but the bottom section is basically empty, not letting me choose any specs for programming (i.e. HS XT LP for osc speed, MCLR power options etc).
The same thing kina happens in icProg, it gives me Config1-7 options in hex format instead of the options it should. Any idea if this could be the problem and how to fix it?

thanks for the replies
By emf
#46518
I think you need to copy some files from your MPLAB installation into the WinPic subdirectory to get the config words to show up properly. You probably forgot to do this when you reinstalled. I think there's a README with the details. I don't know if icprog does something similar.
User avatar
By redteardrop
#46525
EMF is the winner :D thank, I thought it was some sort of setting where it wasn't getting all the info it needed for the chip.
It turns out that MPLab wasn't even installed. I thought that my PB Pro cd would install all I needed, I mean the program was on there. So yeah, I had to install MPlab and then direct winPic to the device folder for all the *.dev files.

Thank you.
Dylan

p.s. just so you all know, I tested the blink code listed here and it works without having power connected to the secondary power pins. It probably would still be a good idea to use them though. I haven't tested about int OSC though.