52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
' ########### start ###########
|
|
' pic:PIC16F876A
|
|
' ########### end ###########
|
|
'
|
|
' ******************************************************************
|
|
' A program to flash LED on PORTA.2
|
|
' 2014-06-30 (c) Paolo Iocco
|
|
' ******************************************************************
|
|
'
|
|
' Circuit diagram
|
|
' ---------------
|
|
' PIC28 Pinout
|
|
' +--\/--+
|
|
' /MCLR VPP 1|o |28 RB7 KBI3 PGD
|
|
' AN0 RA0 2| |27 RB6 KBI2 PGC
|
|
' AN1 RA1 3| |26 RB5 KBI1
|
|
' Vref- AN2 RA2 4| |25 RB4 KBI0
|
|
' Vref+ AN3 RA3 5| |24 RB3 PGM CAN-RX
|
|
' T0CKi RA4 6| |23 RB2 /INT2 CAN-TX
|
|
' SS AN4 RA5 7| |22 RB1 /INT1
|
|
' AVss 8| |21 RB0 /INT0
|
|
' OSC1 9| |20 Vdd
|
|
' OSC2 10| |19 Vss
|
|
' T1CKi RC0 11| |18 RC7 RX DT
|
|
' CCP2 RC1 12| |17 RC6 TX CK
|
|
' CCP1 RC2 13| |16 RC5 SKO D+
|
|
' SCL SCK RC3 14| |15 RC4 SDI D- SDA
|
|
' +------+
|
|
'
|
|
' ******************************************************************
|
|
|
|
'Chip model
|
|
#chip 16f876A, 16
|
|
|
|
#config OSC = HS, WDT = OFF, PWRTE = ON, CP = OFF
|
|
#define led PORTA.2
|
|
|
|
Startup:
|
|
count = ReadAD(AN0)
|
|
'Main routine
|
|
Loop:
|
|
'Turn one LED on, the other off
|
|
SET led ON
|
|
wait 1 sec
|
|
'Now toggle the LEDs
|
|
|
|
SET led OFF
|
|
wait 1 sec
|
|
'Jump back to the start of the program
|
|
goto Loop
|
|
|