R
Rodo
- Jan 1, 1970
- 0
Hi all,
I'm trying some assembly code for the PIC18F1320. I've always used C but the
new job has some projects in assembly code for the cheap PICs (PIC12F508 and
509) and I'm required to be able to modify them. YEACH!. So ... I have some
of these PICs and I'm playing with the stuff. Anyhow ... I'm using the ICD2
and MPLAB 7.4 to write the assy code. It compiles with no errors or
warnings. I'm using the debugger to watch the port pins (PortA and PortB
pins 0) toggle but no luck. Here is the code:
movlw 0x70 ;Internal Oscillator, 31kHz
movwf OSCCON ;
movlw 0 ;set portA for output <---Line0
movwf TRISA ; <---Line1
movlw 1 <---Line2
movwf LATA <---Line3
movwf PORTA ;make all pins low except pin0 <---Line4
movlw 0 ;set portB for output
movwf TRISB ;
movlw 1 ;
movwf PORTB ;make all pins low except pin0
I can see the WREG change when I step through Line0, I also see Line1 turn
the value for TRISA to zero. Then Line2 places a 1 in WREG but line3 and
Line4 don't change the PortA pin0 or the value in the watch window. I tried
writting to the LAT register when the Port didn't work but it didn't make a
difference. I tried to change the bank to 0xf0 like:
movlb 0xf0
between Line0 and Line1 but still no luck.
Can someone shed some light into this please ?
Thanks
I'm trying some assembly code for the PIC18F1320. I've always used C but the
new job has some projects in assembly code for the cheap PICs (PIC12F508 and
509) and I'm required to be able to modify them. YEACH!. So ... I have some
of these PICs and I'm playing with the stuff. Anyhow ... I'm using the ICD2
and MPLAB 7.4 to write the assy code. It compiles with no errors or
warnings. I'm using the debugger to watch the port pins (PortA and PortB
pins 0) toggle but no luck. Here is the code:
movlw 0x70 ;Internal Oscillator, 31kHz
movwf OSCCON ;
movlw 0 ;set portA for output <---Line0
movwf TRISA ; <---Line1
movlw 1 <---Line2
movwf LATA <---Line3
movwf PORTA ;make all pins low except pin0 <---Line4
movlw 0 ;set portB for output
movwf TRISB ;
movlw 1 ;
movwf PORTB ;make all pins low except pin0
I can see the WREG change when I step through Line0, I also see Line1 turn
the value for TRISA to zero. Then Line2 places a 1 in WREG but line3 and
Line4 don't change the PortA pin0 or the value in the watch window. I tried
writting to the LAT register when the Port didn't work but it didn't make a
difference. I tried to change the bank to 0xf0 like:
movlb 0xf0
between Line0 and Line1 but still no luck.
Can someone shed some light into this please ?
Thanks