brn.caldeira
Newbie level 1
- Joined
- Jul 14, 2008
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Brazil - MG - SRS
- Activity points
- 1,291
Hello,
I´m starting programming in C and I have a problem with my code.When I press a key in PC the program points to the begin and does not recognize the characters written.I´m using CCS C Compiler.
#include <18F4620.H> // arquivo de definições do microcontrolador usado
#use delay(clock=10000000) // informa ao sistema o frequência de clock, para temporização
#use rs232(baud=9600,parity=N,xmit=pin_c6,rcv=pin_c7)
#fuses HS,NOFCMEN,NOIESO,PUT,BROWNOUT,BORV43,NOWDT,CCP2C1,NOPBADEN,MCLR,STVREN,NOLVP,NOXINST, NODEBUG, PROTECT,CPB,NOCPD,NOWRT,WRTC,WRTB,NOWRTD,NOEBTR,NOEBTRB
#bit TX_TTL = PORTC.6 // 0 reservado Out
#bit RX_TTL = PORTC.7 // 0 reservado Out
// *** Rotina Principal
void main(void){
unsigned char caract;
int data;
printf("working");
for (;{
switch(getc()){
case '1': printf("potência");
break;
case '2' : printf("temperatura");
break;
}
}
}
someone help me?
I´m starting programming in C and I have a problem with my code.When I press a key in PC the program points to the begin and does not recognize the characters written.I´m using CCS C Compiler.
#include <18F4620.H> // arquivo de definições do microcontrolador usado
#use delay(clock=10000000) // informa ao sistema o frequência de clock, para temporização
#use rs232(baud=9600,parity=N,xmit=pin_c6,rcv=pin_c7)
#fuses HS,NOFCMEN,NOIESO,PUT,BROWNOUT,BORV43,NOWDT,CCP2C1,NOPBADEN,MCLR,STVREN,NOLVP,NOXINST, NODEBUG, PROTECT,CPB,NOCPD,NOWRT,WRTC,WRTB,NOWRTD,NOEBTR,NOEBTRB
#bit TX_TTL = PORTC.6 // 0 reservado Out
#bit RX_TTL = PORTC.7 // 0 reservado Out
// *** Rotina Principal
void main(void){
unsigned char caract;
int data;
printf("working");
for (;{
switch(getc()){
case '1': printf("potência");
break;
case '2' : printf("temperatura");
break;
}
}
}
someone help me?