Seegoon
Newbie level 3
I can't get this simple program 10 lines of code to simulate correctly.
It works fine in mplab simulator. Using XC16 Ver 1.26.
Basically clearing the individual TRIS C registers and setting the appropriate latches.
At the end , doing it in 1 shot.
Is proteus really that useless?
Attached is "main.c" , Proteus project and .cof and .hex files , in a rar file
Below is the code , out of interest..
- - - Updated - - -
Forgot to add what Proteus does :0)
Instead of turning on latches C0 to C3 in turn Proteus does this.
START:
LATC0 =OFF
LATC1 =OFF
LATC2 =OFF
LATC3 =OFF
C0= ON
C1, C2 , C3 = OFF Correct to here :0)
C0 = OFF WRONG FROM HERE ON
C1 = ON
C2 , C3 =OFF
C0 =OFF WRONG
C1 = OFF
C2 = ON
C3 = OFF
C0 to C2 = OFF
C3 = ON
Cheers
Seegoon
It works fine in mplab simulator. Using XC16 Ver 1.26.
Basically clearing the individual TRIS C registers and setting the appropriate latches.
At the end , doing it in 1 shot.
Is proteus really that useless?
Attached is "main.c" , Proteus project and .cof and .hex files , in a rar file
Below is the code , out of interest..
Code:
#include "xc.h"
_CONFIG1(JTAGEN_OFF & GCP_OFF & GWRP_OFF & BKBUG_OFF & ICS_PGx3 & FWDTEN_OFF & FWPSA_PR128 & WDTPS_PS256)
_CONFIG2(FNOSC_PRI & FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_HS)
int main(void)
{
AD1PCFG = 0xFFFF;
TRISCbits.TRISC0 = 0;
LATCbits.LATC0 = 1;
TRISCbits.TRISC1 = 0;
LATCbits.LATC1 = 1;
TRISCbits.TRISC2 = 0;
LATCbits.LATC2 = 1;
TRISCbits.TRISC3 = 0;
LATCbits.LATC3 = 1;
TRISC = 0;
LATC = 0x02FF;
while (1);
}
- - - Updated - - -
Forgot to add what Proteus does :0)
Instead of turning on latches C0 to C3 in turn Proteus does this.
START:
LATC0 =OFF
LATC1 =OFF
LATC2 =OFF
LATC3 =OFF
C0= ON
C1, C2 , C3 = OFF Correct to here :0)
C0 = OFF WRONG FROM HERE ON
C1 = ON
C2 , C3 =OFF
C0 =OFF WRONG
C1 = OFF
C2 = ON
C3 = OFF
C0 to C2 = OFF
C3 = ON
Cheers
Seegoon