[b][red]This message was edited by Hemi265 at 2005-2-16 1:46:5[/red][/b][hr]
I've just delved into the world of microcontrollers with a Pic16F84a on a development board I made from a Kit. It doesn't seem to be functioning correctly, i'm testing it with a program to just to flash a LED but when I change the delay routine in the code (simple repeat loop) do not notice any difference in flashing speed. (quite slow flashing around -- 1 sec on/ 1 sec off)
It's clock is driven by an RC oscillator, and while the program is running if a turn the variable resistor can get a noticable change in the flashing rate. The board has a jumper setting to run a crystal oscillor instead, but when i select this the program appears not to run (no lighting of the LED, even with a program I made that just turns the led on (incase it was flashing too fast to see it was on) -- meaning the chip doesn't function when runing the crystal? Are crystals easily damaged?
Is it possible i could have damamged the PIC somehow to give it this stage functionality? or do they either work or not?
I'm sorry if my questions seem strage, it's just i'm having a lot of diffiuclty, and considering scapping the whole project?!?
Thanks in advance!
Edit:
1. Erased the chip and 'ran' it, no led activity at all (to confirm the chip was erased)
2. Assemble and program the code shown below:
3. Run proram, and observed a slow even (ON/OFF time) flashing led. NOTE: THERE ARE NO DELAY LOOPS IN THIS?! WHAT IS GOING ON?! As i turn the resistor to obtain the fastest flashing speed, the ON/OFF time of the led moves in facour of the ON state, until there is just a slight off every second or so.
This is confusing?!
;*****Set up the Constants****
STATUS equ 03h ;Address of
TRISA equ 85h ;Address of
PORTA equ 05h ;Address of
;****Set up the port****
bsf STATUS,5 ;Switch to Bank 1
movlw 0Feh ;Set the Port A pins
movwf TRISA ;to output.
bcf STATUS,5 ;Switch back to Bank 0
;****Turn the LED on****
Start movlw 0Feh ;Turn the LED
movwf PORTA ;into the w register
movlw 00h ;Turn the LED
movwf PORTA ;into the w register
goto Start ;go back to
end
Again thanks in advance and i hope there is a simple explaination for all this!
Comments
With no delay loops, at 1Mhz clock speed, the flash will only (without taking the time to figure it in real time) take approximately 4 microseconds to occur. TOO FAST FOR THE EYE TO SEE!
Take a look at the simulator offered by OSHONSOFT at oshonsoft.com. No, I don't have any thing to do with this company, but he offers a really good simulator that allows you to see all the PIC register contents as your software executes and yes, I know you can also do this with MPLAB, from Microchip, for free. The Oshonsoft simulator is just way easier for a beginner to use! You can try it out for free for 30 days and if you do buy, $25 is dirt cheap for software plus lifetime updates.
1. Check out picklist.com. Tons of help at this site!
2. Never give up!