Man of Honour
- Joined
- 13 Nov 2009
- Posts
- 11,632
- Location
- Northampton
Ok, Ive had a PIC programmer a while as I used it for some console mod chips awhile back and decided to learn how to use PIC chips and a bit about electronics.
Ive currently got the following programmed to a PIC16F84-04/P
and following the wiring diagram on this attached on a breadboard with the addition of an LM317 and appropriate resistors to drop 9v to 3v and the 330k resistor has been substituted for a 4.7k as I wrote the wrong thing down before i went and bought the components.
the LM317 VRM circuit works fine as it will directly power the LED, and the PIC is programmed as it reads as it should.
http://frozennova.limewebs.com/progtu1.jpg
Ive currently got the following programmed to a PIC16F84-04/P
Code:
#include "p16f84.inc" ; This includes PIC16F84 definitions for the MPASM assembler
;****Set up the port****
bsf 03h,5 ;Go to Bank 1
MOVLW b'00000' ;Put 00000 into W
movwf 85h ;Move 00000 onto TRISA ? all pins set to output
bcf 03h,5 ;Come back to Bank 0
;****Turn the LED on****
MOVLW b'11111' ;Write W register. In binary this is 11111
movwf 05h ;Now move the contents of W (02h) onto the PortA, whose
;address is 05h ;and also just in case we miss ;the goto instruction.
end
and following the wiring diagram on this attached on a breadboard with the addition of an LM317 and appropriate resistors to drop 9v to 3v and the 330k resistor has been substituted for a 4.7k as I wrote the wrong thing down before i went and bought the components.
the LM317 VRM circuit works fine as it will directly power the LED, and the PIC is programmed as it reads as it should.
http://frozennova.limewebs.com/progtu1.jpg