sacban
Junior Member level 3
- Joined
- Aug 20, 2015
- Messages
- 29
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 412
char txt,txt1;
char hrd,hrd1;
char hmd,hmd1;
void main() {
TRISB.F0=0;
TRISB.F3=0;
TRISB.F4=0;
PORTB=0x00;
UART1_Init(9600);
delay_ms(120);
while(1){
if(UART1_Data_Ready() == 1){
hrd = UART1_Read();
if(hrd == 'Z'){
delay_ms(100);
hrd1 = UART1_Read();
if(hrd1 == 'X'){
delay_ms(100);
txt = UART1_Read();
if(txt == 'A'){
PORTB.F0=~PORTB.F0;
}else if(txt == 'A'){
PORTB.F0=~PORTB.F0;
}
}
//***************************************************//
if(UART1_Data_Ready() == 1){
hmd = UART1_Read();
if(hmd == 'Z'){
delay_ms(100);
hmd1 = UART1_Read();
if(hmd1 == 'X'){
delay_ms(100);
txt1 = UART1_Read();
if(txt1 == 'A'){
PORTB.F4=~PORTB.F4;
}else if(txt1 == 'A'){
PORTB.F4=~PORTB.F4;
}else{
}
}
}
}
}
}
}
}
int asu,asu1;
void main() {
asu =0;
asu1=0;
TRISA.F0=1; // RA0 As Input
TRISA.F1=1; // RA1 As Input
TRISB = 0x00; // Set To Output
PORTB=0x00; // Clear
UART1_Init(1200);
delay_ms(100);
while(1){
if(PORTA.F0 == 1){
asu = 1;
}
if(asu == 1 && PORTA.F0 == 0){
asu = 0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
}
}
if(PORTA.F1 == 1){
asu1=1;
}
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
}
}
}
}
Hi,
What is the problem? Give an error description.
Klaus
TRISB = 0x02;
=> if(PORTA.F1 == 1){ // Toggle RA1
// Read RB0 not RB4.
=> if(UART1_Data_Ready() == 1){
hmd = UART1_Read();
if(hmd == 'Z'){
delay_ms(100);
hmd1 = UART1_Read();
if(hmd1 == 'X'){
delay_ms(100);
txt1 = UART1_Read();
if(txt1 == 'A'){
PORTB.F4=~PORTB.F4;
}else if(txt1 == 'A'){
PORTB.F4=~PORTB.F4;
char txt,txt1;
char hrd,hrd1;
char hmd,hmd1;
void main() {
TRISB.F0=0;
TRISB.F3=0;
TRISB.F4=0;
TRISB.F1=1;
PORTB=0x00;
UART1_Init(9600);
delay_ms(120);
while(1){
if(UART1_Data_Ready() == 1){
hrd = UART1_Read();
if(hrd == 'Z'){
delay_ms(120);
hrd1 = UART1_Read();
if(hrd1 == 'X'){
delay_ms(120);
txt = UART1_Read();
if(txt == 'A'){
PORTB.F0=~PORTB.F0;
}else if(txt == 'A'){
PORTB.F0=~PORTB.F0;
}
}
//***************************************************//
if(UART1_Data_Ready() == 1){
hmd = UART1_Read();
if(hmd == 'Z'){
delay_ms(120);
hmd1 = UART1_Read();
if(hmd1 == 'X'){
delay_ms(120);
txt1 = UART1_Read();
if(txt1 == 'A'){
PORTB.F4=~PORTB.F4;
}else if(txt1 == 'A'){
PORTB.F4=~PORTB.F4;
}else{
}
}
}
}
}
}
}
}
int asu,asu1;
void main() {
asu =0;
asu1=0;
TRISA.F0=1; // RA0 As Input
TRISA.F1=1; // RA1 As Input
TRISB = 0x00; // Set To Output
PORTB=0x00; // Clear
UART1_Init(9600);
Delay_ms(120);
while(1){
if(PORTA.F0 == 1){
asu = 1;
}
if(asu == 1 && PORTA.F0 == 0){
asu = 0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
}
}
if(PORTA.F1 == 1){
asu1=1;
}
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
}
}
}
}
//if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
if(PORTA.F1 == 1){
asu1=1;
}
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
UART1_Write('X');
UART1_Write('A');
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('A');
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('B');
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('C');
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('D');
if(asu1 == 1 && PORTA.F1 == 0){
asu1=0;
if(UART1_Tx_Idle() == 1){
UART1_Write('Z');
UART1_Write('X');
UART1_Write('E');
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?