OK
Some chips have an internal MCLR , I like these for ICSP.
Let us know how you code works out and where you need help from there.
OK
Some chips have an internal MCLR , I like these for ICSP.
Let us know how you code works out and where you need help from there.
Dave
Always wear safety glasses while programming.
Im stuck already. You knew it wouldnt be long :P
Im using a 16MHz oscillator. In my code i have put "define osc 16". The rest of the code simply turns an LED on an off a few times to show the chip is working.
What im getting is a quick flash when it powers up and when it powers down.
I think this might be to do with the fuse settings. What should the following be set to?
WDT
PWRTE
BODEN
LVP
MCLRE (i assume E means external so Matt had this disabled)
Oscillator
Code Protect (i know this should be disabled)
for Oscillator i have the following options to choose from
ERCLK
ERIO
IRCCLK
IRCIO
EXTCLK
LP
XT
HS
The other options are enabled/disabled.
BTW. Do you want me to start new threads for any questions about this or stick to this one? Its all the same project
Edit: Im using a PIC16F627
MCLRE is just the name.
For internal (Not used for reset but the pins other functions) the fuse should be
_MCLRE_OFF
HS for the OSC
Dave
Always wear safety glasses while programming.
Woo it worksIts a bit fast though. i put 100ms pauses in and it flashes a lot faster than when i use a 4MHz resonator. I know 16MHz is 4 times faster but i thought the point of declaring that was so "pause 100" would still take 100ms and not 25. Maby ive got something else wrong. I was reading about timers in the datasheet. I didnt understand any of it but part of it could mean the chip runs 4 times faster than the resonator you use.
It doesnt matter anyway. If i want 100ms then i just type 400. The point is the LED flashes. Tomoz ill get onto the real code but its 10:00 now so i should be getting to bed. Up at 4:30AM for work
Anyways. Thanx for that. I would have been lost trying to figure it out myself
Where are you setting the fuses? In the *.inc file or in the code.
A programmer never sleeps. When things get fuzzy is when some of the best work is done![]()
Last edited by mackrackit; - 28th November 2007 at 23:11.
Dave
Always wear safety glasses while programming.
Im setting the fuses in the programmer software right after loading the file. How do you do it in PBP? Its annoying having to keep setting them.
Also, Serial doesnt appear to be working. This is probs to do with the same problem but how do i figure out what value to give to spbrg? I found this page but im not sure what it all means. I entered 16 and it gives me a table. How do i know what BRGH is set to?
Edit: Just downloaded a calculator from Mister_e's website. It makes more sense but its still not working. I think ill go sleep on it![]()
Last edited by The Master; - 28th November 2007 at 23:25.
Solved the oscillator problem.
"DEFINE osc 16" doesnt work
"DEFINE OSC 16" does work
Serial still not working but i have a feeling thats something simple.
Ive tried 2 things from Mister-e's calculator
Code:DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0 DEFINE HSER_SPBRG 25 ' 9600 Baud @ 16MHz, 0.16% DEFINE HSER_CLROERR 1 ' Clear overflow automaticallyI have also added this codeCode:RCSTA = $90 ' Enable serial port & continuous receive TXSTA = $20 ' Enable transmit, BRGH = 0 SPBRG = 25 ' 9600 Baud @ 16MHz, 0.16%
when any serial data comes in that should make the LED flash but its not doing. I think this might be to do with the circuit itself (currently thinking outside of the box. Using breadboard instead). Ill try and solve that tomoz. For now though i really am going to bed :P Ill let you know how it goes tomozCode:loop: if pir1.5=1 then newbyte=rcreg high portb.0 pause 100 low portb.0 endif goto loop
Bookmarks