Works on 16F but not on 18F - what am I missing?
I've learned lots from this forum - thanks everyone. But now I have a specific problem I cant find an answer to...
I've been coding away happily on a 16F1937, but have hit the array size limit for my program.
I bought an 18F45K80 but cant get it to work. I went right back to a hello world blinking LED with blink.pbp from the examples folder - got it working in a circuit with the 16F and then recompiled etc targeting the 18F and put it in the known working circuit. No luck.
Is there something I need to include on the circuit to accommodate the new chip? Something in the code that needs to be changed?
Here is the code:
Code:
' Name : BLINK.pbp
' Compiler : PICBASIC PRO Compiler 2.6
' Assembler : PM or MPASM
' Target PIC : 16F or 18F types
' Hardware : Non specific
' Oscillator : internal or external
' Keywords : BLINK LED
' Description : PICBASIC PRO program to to blink an LED connected
' to PORTB.0 about once a second
'
'The following program is a simple test to blink an LED on and off. Select a
'device in the dropdown list above, then click the Compile Only button on the
'toolbar to compile the program and generate a hex file.
' Configure pins for digital operation (uncomment as needed).
' These settings are intended as simple examples. For more detail,
' see the appropriate device datasheet for register descriptions.
'ANSEL = 000000 ' 16F88, 16F688, 16F690, 16F88x
'ANSELH = 000000 ' 16F690, 16F88x
'ADCON1 = 000111 ' 16F87x, 16F87xA, 18F452
'ADCON1 = 001111 ' 18F4620
TRISB = 0
LED VAR PORTB.0 ' Assign name "LED" to PORTB.0
mainloop:
High LED ' Turn on LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Low LED ' Turn off LED connected to PORTB.0
Pause 500 ' Delay for .5 seconds
Goto mainloop ' Go back to loop and blink LED forever
End
I took a pictr of the breadboard layout, but I'm having trouble getting it onto the board - I'll update if I manage it.
Re: Works on 16F but not on 18F - what am I missing?
Try ADCON1 = 15 to set to all digital. It looks like portb.0 is an analog pin.
Re: Works on 16F but not on 18F - what am I missing?
Config settings are the only difference using an 18F with v2.6 (I have v2.60c).
There are no changes to circuitry, Blinky should work.
18F have a lot more config settings available though.
Robert
Edit: is the default osc settings the same with this 18F?
Re: Works on 16F but not on 18F - what am I missing?
Thanks for the replies
Quote:
Originally Posted by
peterdeco1
Try ADCON1 = 15 to set to all digital. It looks like portb.0 is an analog pin.
Tried that last night - with and with out the TRISB statement also
also tried a different pin (D0)
No luck.
I have another chip (min order qty 2) so I'll try that tonight. I assumed if it programmed OK it wasn't dead...
Re: Works on 16F but not on 18F - what am I missing?
Quote:
Originally Posted by
Demon
Config settings are the only difference using an 18F with v2.6 (I have v2.60c).
There are no changes to circuitry, Blinky should work.
18F have a lot more config settings available though.
Robert
Edit: is the default osc settings the same with this 18F?
Hmm, I'll mess around with putting an oscillator on the circuit too. Thanks.