| ??? 10/22/04 17:34 Read: times |
#79737 - RE: uC to VBfront end Responding to: ???'s previous message |
One way to handle your requirement would be as below :
1. Wait for 100ms 2. Read Port 0 3. Move it to ACC 4. Call SNDBYT 5. Handle the two ASCII values in VB 6. Jump to step 1 I have given below two assembly routines - SNDTXT will send one ASCII value (in ACC) and the SNDBYT will send two ASCII values corresponding to the value of the accumulator. Use as required. For the whole thing to work your VB code must be done properly - much easier to use the ComEvent. Idea is to have it ready to recieve when the MCU is ready to send.
;==============================================
SNDTXT: NOP ;send text pointed at by DPTR
MOV A, #0
MOVC A, @A+DPTR
CALL SND232 ; move it to com port
RET
SND232: JNB SCON.1, $ ; wait for previous character to go..
CLR SCON.1 ; and send current character to COMM
MOV SBUF, A
RET
;================================================
SNDBYT: PUSH ACC ; send hex BYTE - each nibble as ASCII
SWAP A ; Will send Hi nibble first
CALL SNDLOW ; Sent.
POP ACC ; Will send low nibble next
SNDLOW: ANL A, #0FH
CLR C
ADD A, #246
JC HEXOUT
ADD A, #58 ; 0 to 9 character
JMP SND232
SNDHEX: ADD A, #65 ; A to F character
JMP SND232
;==============================================
PS: The code must assemble without errors. Pulled out of a large code and labels corrected suitably. Raghu |
| 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 |



