??? 10/20/04 16:26 Read: times |
#79639 - RE: uC to VBfront end Responding to: ???'s previous message |
Hello Harnan,
I cleaned up your code to make it more readable. Regards, Charles Bannister ;******************************************************************** ; Subject: uC to VBfront end ; Full Name: Harnam Singh Thakur Registered Member User Profile ; http://www.8052.com/forum/read.phtml?id=79631 ; Date: 10-20-04 08:36 ; Read: 28 times ; Score: Hasn't been scored ; Hello friends, ; I am struggling to send the data from uC (Port pins which are ; connected to switches) to VBfront end.Any kind of suggestions ; or help will be highly appreciated. ; Whereas sending data from the VB front is OK . ; I am using P89C51rd2 ; The project have vb front end with 5 switches and status ; indicators and it is working ok, while sending #31H and #38h ; for switching on and off light1 and so on ; respectively.Status is being changed by receiving #43H_ _ _ _ #47H. ; The code is ; Regards ; Harnam ;******************************************************************** ORG 0000H reset1: MOV IE,#00000000B MOV TMOD,#00100000 MOV TL1,#0FDH MOV TH1,#0FDH MOV SCON,#01000000B SETB TR1 MOV P1,#11111111B INDEX: ACALL SUB_RXD ACALL_LIGHT1_ON ACALL_LIGHT1_OFF ;--------------- ;--------------- ACALL_LIGHT5_ON ACALL_LIGHT5_OFF SJMP INDEX SUB_RXD: JNB RI,$ CLR RI MOV A, SBUF RET LIGHT1_ON: CJNE A,#31h,NEXT CLR P1.0 ACALL sUB_TXD1 SJMP INDEX LIGHT1_OFF: cjne A,#38h,NEXT SETB P1.0 SJMP INDEX NEXT: RET SUB_TXD1: MOV SBUF, 43H JNB TI,$ CLR TI RET ;--- ;----- SUB_TXD5: MOV SBUF, 47H JNB TI,$ CLR TI RET END ;******************************************************************** ; Now I like to connect 8 switches to uC Port 0 and send #30H ; to #37H to front end. I tried Mazidi book example 11-10, I ; can not understand how to send the #30H,#31H,#33H... to ; serial. In previous program by pressing ; switch 1 in front end, uC was receiving #31H and switching ; On light1. In the following program when I toggle P0.0, ; front end is receiving garbage How to send the data from ; individual pins ie. P0.0,P0.1......P0.7 to ; front end ???? ;******************************************************************** ORG 0 reset2: LJMP MAIN ORG 000BH ;ISR FOR TIMER 0 CPL P0.1 ;TOGGLE P0.1 RETI ;RETURN FROM ISR ORG 23H LJMP SERIAL ;JUMP TO SERIAL INT. ISR ORG 30H MAIN: MOV P1,#0FFH ;MAKE P1 AN INPUT PORT MOV TMOD,#22H ;TIMER 0&1,MODE 2, AUTO RELOAD MOV TH1,#0F6H ;4800 BAUD RATE MOV SCON,#50H ;8-BIT,1 STOP,REN ENABLED MOV TH0,#-92 ;FOR 5 KHZ WAVE. MOV IE,#10010010B ;ENABLE SERIAL,TIMER 0 INT. SETB TR1 ;START TIMER 1 SETB TR0 ;START TIMER 0 BACK: MOV A,P1 ;READ DATA FROM PORT 1 MOV SBUF,A ;GIVE A COPY TO SBUF MOV P2,A ;WRITE IT TO P2 SJMP BACK ;STAY IN LOOP INDEFINITELY ;------------------SERIAL PORT ISR ORG 100H SERIAL: JB TI,TRANS ;JUMP IF TI IS HIGH MOV A,SBUF ;OTHERWISE DUE TO RECEIVE MOV P0,A ;SEND SERIAL DATA TO P0 CLR RI ;CLEAR RI SINCE CPU DOES NOT RETI ;RETURN FROM ISR TRANS: CLR TI ;CLEAR TI SINCE CPU DOES NOT RETI ;RETURN FROM ISR END |
Topic | Author | Date |
uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
RE: uC to VBfront end | 01/01/70 00:00 | |
Some more refinements... | 01/01/70 00:00 | |
RE: uC to VBfront end![]() | 01/01/70 00:00 |