hello guys, i have this code at the end of the post, which control 8 devices over bluetooth. im trying to figure out what command that i can send over hyperterminal to activate a port or a pin. to my understanding if i want to set pin1.0 i should send 'A'>0AH>31H is that correct?
any kind of help is really appreciated. here's a portion of the code
LOAD1 EQU P1.0 LOAD2 EQU P1.1 LOAD3 EQU P1.2 LOAD4 EQU P1.3 LOAD5 EQU P1.4 LOAD6 EQU P1.5 LOAD7 EQU P1.6 LOAD8 EQU P1.7 DSEG ; This is internal data memory ORG 20H ; Bit adressable memory MOBILE: DS 3 COUNTER: DS 1 CSEG ; Code begins here ; ---------==========----------==========---------=========--------- ; Main routine. Program execution starts here. ; ---------==========----------==========---------=========--------- ORG 00H ; Reset AJMP MAIN ORG 0023H AJMP SERIAL ; ---------==========----------==========---------=========--------- MAIN: MOV SP,#40H MOV TMOD,#20H ;initilize serial port MOV TH1,#0FDH ;Slect 9600 baud rate MOV SCON,#50H MOV A,PCON SETB ACC.7 MOV PCON,A MOV IE,#10010000B SETB TR1 ;start timer MOV COUNTER,#00H MOV P1,#00H AJMP $ ;************************************************************************** SERIAL: JB TI,TRAS1 MOV A,SBUF CJNE A,#'A',DOWNW MOV COUNTER,#00H AJMP DOWN1 TRAS1: AJMP TRAS DOWNW:CJNE A,#0AH,DOWNW1 CALL DEVICE_DECODE AJMP DOWN1 DOWNW1:MOV A,COUNTER CJNE A,#01H,SD1 MOV MOBILE,SBUF AJMP DOWN1 SD1: CJNE A,#02H,DOWN1 MOV MOBILE+1,SBUF DOWN1:INC COUNTER CLR RI RETI TRAS: CLR TI RETI ;************************************************************************** DEVICE_DECODE: MOV A,MOBILE ;LOAD 1 CJNE A,#31H,SDF1 MOV A,MOBILE+1 CJNE A,#31H,SDF2 SETB LOAD1 AJMP SDF1 SDF2: CJNE A,#32H,SDF1 CLR LOAD1 SDF1:
Where did you get it? Did it not come with any documentation?
online but unfortunately no documentation, most of the code is initializations and setting for a serial communication, the processing starts from "SERIAL:" i believe. these loops are what confusing me. the "DEVICE_DECODE:" section extends to 8 loads, but its just repetition of what's in "LOAD 1"
and to add, This routine will intialize the "COUNTER" to 00, when the serial port receive character A. The next 2 bytes which are received after the character A is stored into "MOBILE" and "MOBILE+1" If data "0AH" is received then the routine jumps to DEVICE_DECODE.
but correct me if im wrong, the data "0AH" means ascii a new line? and how am i supposed to enter that from the HyperTerminal.
Where did you get it? online but unfortunately no documentation,
If you can not code the project yourself, downloaded code is worthless.
Erik
PS If you can code the project yourself, downloaded code MAY (not 'will') save you some time
Well, the ASCII code for Line Feed is certainly 0x0A...
"how am i supposed to enter that from the HyperTerminal"
Ctrl+J = LF; Ctrl+M = CR.
hi, thanks for the feedback, but what do they mean? Ctrl+J = LF; Ctrl+M = CR.
btw if want to send A11 over the serial port. would that be .. ("A11") or sendChar("A11") or write.serial("A11") or sendString("A11")
i know that writing my own code should make things easier, which i tried in both assembly and C, but it didn't work, understanding the key elements in this code is my way of learning right now.
"Ctrl+J" means "press 'J' while holding down the 'Ctrl' key"
You know - like "Ctrl+Alt+Del"...