GraffZeppelin
New Member
Hello,
I am trying to simulate some digital outputs from Pic18F27J13 in Proteus, but what happens is that only the last RA2 bit is set to high.
If I erase the lines PORTAbits.RA2 = 1; and PORTAbits.RA2 = 0; , then only pin RA1 is getting high. Same for RA0..
My setting :
What could be the issue?
I am trying to simulate some digital outputs from Pic18F27J13 in Proteus, but what happens is that only the last RA2 bit is set to high.
If I erase the lines PORTAbits.RA2 = 1; and PORTAbits.RA2 = 0; , then only pin RA1 is getting high. Same for RA0..
My setting :
Code:
/* Main.c file generated by New Project wizard * * Created: Thu Jan 23 2014 * Processor: PIC18F27J13 * Compiler: HI-TECH C for PIC18 */
#include <htc.h>
void delay_ms(unsigned int ui_value);
void main(void)
{
TRISA = 0;
PORTAbits.RA0 = 0;
PORTAbits.RA1 = 0;
PORTAbits.RA2 = 0;
while (1)
{
PORTAbits.RA0 = 1;
PORTAbits.RA1 = 1;
PORTAbits.RA2 = 1;
delay_ms(50);
PORTAbits.RA0 = 0;
PORTAbits.RA1 = 0;
PORTAbits.RA2 = 0;
delay_ms(50);
}
}
void delay_ms(unsigned int ui_value)
{
while (ui_value-- > 0)
{
__delay_ms(1);
}
}
What could be the issue?