'18F2431 ASM led test
Define CONFIG1L = 0x00
Define CONFIG1H = 0x86
Define CONFIG2L = 0x0c
Define CONFIG2H = 0x00
Define CONFIG3L = 0x00
Define CONFIG3H = 0x81
Define CONFIG4L = 0x80
Define CONFIG4H = 0x00
Define CONFIG5L = 0x0f
Define CONFIG5H = 0xc0
Define CONFIG6L = 0x0f
Define CONFIG6H = 0xe0
Define CONFIG7L = 0x0f
Define CONFIG7H = 0x40
''Define SIMULATION_WAITMS_VALUE = 1 'SIMULATION ONLY
AllDigital '''''''''' On power PORTA is Analog! so make digital!!
OSCCON = %01110001 'internal 8Mhz clock
'I have only changed these to suit a board I am testing,
'dont want To rewire judt To test an LED
TRISA = %10011111
TRISB = %00001111
TRISC = %10001001
main:
If PORTA.7 = 1 Then
RA6 = 1 'LED
Endif
If PORTA.7 = 0 Then
RA6 = 0 'LED
Endif
Goto main
End
Hi E,hi C,
How are you indenting.?
E
Update, try this.
Code:'18F2431 ASM led test Define CONFIG1L = 0x00 Define CONFIG1H = 0x86 Define CONFIG2L = 0x0c Define CONFIG2H = 0x00 Define CONFIG3L = 0x00 Define CONFIG3H = 0x81 Define CONFIG4L = 0x80 Define CONFIG4H = 0x00 Define CONFIG5L = 0x0f Define CONFIG5H = 0xc0 Define CONFIG6L = 0x0f Define CONFIG6H = 0xe0 Define CONFIG7L = 0x0f Define CONFIG7H = 0x40 ''Define SIMULATION_WAITMS_VALUE = 1 'SIMULATION ONLY AllDigital '''''''''' On power PORTA is Analog! so make digital!! OSCCON = %01110001 'internal 8Mhz clock 'I have only changed these to suit a board I am testing, 'dont want To rewire judt To test an LED TRISA = %10011111 TRISB = %00001111 TRISC = %10001001 main: If PORTA.7 = 1 Then RA6 = 1 'LED Endif If PORTA.7 = 0 Then RA6 = 0 'LED Endif Goto main End
Hi E,hi C,
You must use the TAB key, Space will not work.
E
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | Copying from UNO R3 to my own empty board? | Microcontrollers | 28 | |
H | Copying FPGAs For Repair Purposes | FPGAs (Field Programmable Gate Array) | 0 | |
![]() |
Copying a full HardDisk | General Electronics Chat | 10 | |
J | Copying Program Code into RAM | Programming & Languages | 5 | |
A | copying data from SPI flash memory | Microcontrollers | 2 |