| ??? 08/05/04 00:37 Read: times |
#75436 - Sample code and MAX232 IC Responding to: ???'s previous message |
Hello Gerardo,
1. You said the hardware is very strange. I agree. Stop fiddling with 74hc14 and start using a regular RS-232 level converter like the MAX232. As to the signal levels -3 to -25V is considered a mark or logic "1" and +3 to +25V is considered a space or logic "0". If you think it is wonky, yes it is. But has reasons for it. Get the complete information about this standard, the cables to use and other pertinent info. from this excellent site http://www.camiresearch.com/Data_Com_...hor1154232 2. If you need a code and other members don't feel that I am spoon feeding here we go :
; Tested OK with 89c51RD2 kit running with 12Mhz crystal.
; Just configure COM2 port in Hyperterminal (Win_9x) for 4800/8/N/1 and set it to Auto Detect.
; Works with all types of terminal emulation in Hyper Terminal. Only in ViewData type there is
; some extra characters at the end. But still message can be read.
V24SPD EQU 256-26
ORG 0000H
V24SET: MOV PCON, #80H
MOV TMOD, #22H
MOV TH1, #V24SPD
MOV TL1, #V24SPD
SETB TCON.6
MOV SCON, #052H
;----------------------------------
MAIN: MOV R7, #5 ; To print message 5 times
NEXT: MOV DPTR, #MSG
LCALL STXT
LCALL CRLF
MOV R4, #10
MOV R5, #255
MOV R6, #255
DLYLUP: DJNZ R5, $
MOV R5, #255
DJNZ R6, DLYLUP
MOV R6, #255
DJNZ R4, DLYLUP
DJNZ R7, NEXT
SJMP $
;---------------------------------
STXT: NOP ; send text from program store at DPTR
MOV A, #0 ; destroy ACC and DPTR
MOVC A, @A+DPTR
JZ ETXT
LCALL SEND
INC DPTR
SJMP STXT
ETXT: RET
BLANK: MOV A, #' ' ; send BLANK
SJMP SEND
CRLF: MOV A, #13 ; send a Carriage Return + Line Feed
LCALL SEND
MOV A, #10
LCALL SEND
RET
Hope that helps. Raghu |
| Topic | Author | Date |
| serial initialization | 01/01/70 00:00 | |
| RE: serial initialization | 01/01/70 00:00 | |
| RE: serial initialization | 01/01/70 00:00 | |
| RE: serial initialization | 01/01/70 00:00 | |
| Serial initialization Programs | 01/01/70 00:00 | |
| RE: Serial initialization Programs | 01/01/70 00:00 | |
| Sample code and MAX232 IC | 01/01/70 00:00 | |
| Serial port files + notes | 01/01/70 00:00 | |
| RE: Serial port files + notes | 01/01/70 00:00 | |
| RE: Serial port files + notes | 01/01/70 00:00 | |
| RE: Serial port files + notes | 01/01/70 00:00 | |
| serial initialization, success | 01/01/70 00:00 | |
RE: serial initialization | 01/01/70 00:00 |



