Diagnostic Program

Thread Starter

PIC GUY TREVOR

Joined Mar 8, 2009
28
Hi All

I am having trouble designing a diagnostic program that checks all the output ports on my pic16F84A whch is controlling my prototype board.

Thanks
 

thatoneguy

Joined Feb 19, 2009
6,359
This is will flash LEDs alternating on both ports, Swap out instructions/ports for assembly/C code for your uC.

Here is the code as compiled by BoostC, showing the assembly output. Note: This will not directly assemble, as I left out the delay code.

Rich (BB code):
void main()

{

    trisa=0;  // porta all output
002F  1683      BSF STATUS, RP0
0030  1303      BCF STATUS, RP1
0031  0185      CLRF gbl_trisa

    trisb=0;  // portb all output
0032  0186      CLRF gbl_trisb

    porta=0xAA; // 10101010
0033  30AA      MOVLW 0xAA
0034  1283      BCF STATUS, RP0
0035  0085      MOVWF gbl_porta

    portb=0xAA;
0036  0086      MOVWF gbl_portb

   
while (1)
0037        label3
0041  2837      GOTO    label3

{
porta^=0xFF;  // Invert 8 bits
0037  30FF      MOVLW 0xFF
0038  0685      XORWF gbl_porta, F

delay_ms(50);
0039  3032      MOVLW 0x32
003A  00A0      MOVWF delay_ms_00000_arg_del
003B  2003      CALL delay_ms_00000

portb^=0xFF;  // Invert 8 bits
003C  30FF      MOVLW 0xFF
003D  0686      XORWF gbl_portb, F

delay_ms(50);  
003E  3032      MOVLW 0x32
003F  00A0      MOVWF delay_ms_00000_arg_del
0040  2003      CALL delay_ms_00000

}
}
 
Top