58 lines
1.7 KiB
Plaintext
58 lines
1.7 KiB
Plaintext
' ########### start ###########
|
|
' pic:PIC16F887
|
|
' ########### end ###########
|
|
'
|
|
' ******************************************************************
|
|
' A program to flash LED on PORTA.2
|
|
' 2014-06-30 (c) Paolo Iocco
|
|
' ******************************************************************
|
|
'
|
|
' Circuit diagram
|
|
' ---------------
|
|
' PIC40 Pinout
|
|
' +--\/--+
|
|
' /MCLR VPP 1|o |40 RB7 KBI3 PGD
|
|
' AN0 RA0 2| |39 RB6 KBI2 PGC
|
|
' AN1 RA1 3| |38 RB5 KBI1
|
|
' Vref- AN2 RA2 4| |37 RB4 KBI0
|
|
' Vref+ AN3 RA3 5| |36 RB3 PGM CAN-RX
|
|
' T0CKi RA4 6| |35 RB2 /INT2 CAN-TX
|
|
' SS AN4 RA5 7| |34 RB1 /INT1
|
|
' RD AN5 RE0 8| |33 RB0 /INT0
|
|
' WR AN6 RE1 9| |32 Vdd
|
|
' CS AN7 RE3 10| |31 Vss
|
|
' AVdd 11| |30 RD7 PSP7
|
|
' AVss 12| |29 RD6 PSP6
|
|
' OSC1 13| |28 RD5 PSP5
|
|
' RA6 OSC2 14| |27 RD4 PSP4
|
|
' T1CKi RC0 15| |26 RC7 RX DT
|
|
' CCP2 RC1 16| |25 RC6 TX CK
|
|
' CCP1 RC2 17| |24 RC5 SKO D+
|
|
' SCL SCK RC3 18| |23 RC4 SDI D- SDA
|
|
' PSP0 RD0 19| |22 RD3 PSP3
|
|
' PSP1 RD1 20| |21 RD2 PSP2
|
|
' +------+
|
|
'
|
|
' ******************************************************************
|
|
|
|
'Chip model
|
|
#chip 16f887, 8
|
|
|
|
#config OSC = INTOSCIO, 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
|
|
|