Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

need hitech config help

Status
Not open for further replies.
ok thanx for your help very very much thanx

and hitech working by changing config settings now i can write any thing and it wil scroll

now i have problems with reading input pins (RA0, RA1, RA2)

am supplying voltage to this pins using 5.1v zener diode and pull up resistors from 12v

how can i read it ?
by if statement or by interrupt ?

i used the following code in main function

while(1)
{

if (PORTA & 0b00000001 != 0)
{

ScrollText(" STOP" );

}
if (PORTA & 0b00000010 != 0)
{
ScrollText(" <<<" );

}
if (PORTA & 0b00000100 != 0)
{

ScrollTextRight(">>> " );

}
}


but it dont worked is it correct?

or how can i use interupt for this?

pls help me ?
 
Could you post your whole code so we can see how you have portA configured. You are still using 18f2550
right?
 
Last edited:
Code:
void main(void)
{


OSCCON=0xf0;
T0CON=0xC1;
TMR0H=0;
TMR0L=240;
INTCON=0;
INTCON2=0;
INTCON3=0;
PIR1=0;
PIR2=0;
PIE1=0;
PIE2=0;
IPR1=0;
IPR2=0;
IPEN=0;
ADCON0=0;
ADCON1=0x0f;
ADCON2=0;


T1CON=0;
T2CON=0;
T3CON=0;

SSPCON1=0;
SSPCON2=0;
RCSTA=0;
TRISA=0b00000111;
TRISB=0;
TRISC=0b10000000;

CCP1CON=0,
CCP2CON=0;

SPBRG=51;
TXSTA=0x22;
RCSTA=0x90;
BAUDCON=0x48;
SPBRGH=0;
POR=1;
Clear();
IPEN=1;
PORTA = 0b00000000;
PORTB = 0b00000000;
PORTC = 0b00000000;
GIEH = 1;
GIEL = 1;
//INTCONbits.PEIE = 1;
TMR0IE = 1;

    while(1)
    {

if (PORTA & 0b00000001 != 0)
{

ScrollText("   STOP" );

}
if (PORTA & 0b00000010 != 0)
{

ScrollText("   <<<" );

}
if (PORTA & 0b00000100 != 0)
{

ScrollTextright("   >>>" );

}
    }
}

am also attached image showing connection to input pins
 

Attachments

  • POWER TO INPUT.GIF
    POWER TO INPUT.GIF
    32.5 KB · Views: 113
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top