|
IAN
3 posts
 Popping In
|
01-09-2010 14:48
Hi
I have just started the PIC programming course and have a strange error with this short program
asm
{
// Port C = Switches and Port B = LEDS
// Make port C switch 0 an input by setting reg to 1
movlw 0b0001111
movwf _trisc
// Initialise port C Switches zero
movlw 0b00000000
movwf _portc
// Set b0 LEDS to output
movlw 0b11110000
movwf _trisb
Again:
// "Check switch" on port c and copy result to port b
// i.e. turn on LED when switch pressed or vice versa
movff _portc,_portb
goto Again
}
As you can see this is a simple adaption of asm prog on p73/74 of course notes.
All works fine with I press SW0, SW1 and SW3 i.e. the corresponding LED on Port B lights, how ever when I press SW4 the corresponding LED does nt light. I tested SW3 with a MM and it it appears to be working fine. I also know that all the LEDS are working because this prog lights all the LEDS
asm Test ALL LEDS working
{
movlw 0b00000000
movwf _trisb
movlw 0b11111111
movwf _portb
}
So anyody got an idea why the SW3 does not light a LED
tks
Noel
|
|
sarma
202 posts
 Power User
|
01-09-2010 20:12
while i am not in possession of the said course notes,
the datasheet says
"In PIC18F2455/2550/4455/4550 devices, the RC3 pin is not implemented."
Also under the table 10-6, a note reads
"Note 1: RC5 and RC4 are only available as port pins when the USB module is disabled (UCON = 0)."
Hope this info helps.
Post edited by sarma
on 01-09-2010 20:17 Post edited by sarma
on 01-09-2010 20:40
|
|
IAN
3 posts
 Popping In
|
01-09-2010 20:49
thank you
|