This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

hi

hi Also i had done on transmitting and receiving a character. but then on transmitting and receiving a string.. i have done it but then it is not receving what i had transmitted...what is the problem?? but can any give me a guide or source??

Parents Reply Children
  • i am using C8051F226. i tried on transmitting a character and it is working just that now i changed it to transmitting and receiving a string and i does not work.. the receiving program....
    $include (c8051f200.inc)

    flag bit 00h
    ERR_FLG EQU 01H
    MSG EQU 600H

    ORG 0000H
    JMP MAIN
    org 23H
    jmp serial_isr
    ORG 0100H
    ;---------------SETTING--------------------
    MAIN: ;CLOCK SETTING
    NOP
    NOP
    NOP
    MOV OSCXCN,#0E7H
    NOP
    NOP
    NOP
    ORL OSCXCN,#00H
    NOP
    NOP
    MOV OSCICN,#08H ;-> INTERNAL OSCILLATOR CONTROL SETTING
    NOP
    NOP
    MOV WDTCN,#0DEH
    mov WDTCN, #0ADH
    ;//Port initialization for P0.0, Page 93
    MOV PRT0CF,#03H
    MOV P0MODE,#03H
    MOV PRT0MX,#01H
    MOV P0,#0FCH
    MOV PRT1CF,#0FFH
    MOV P1MODE,#0FFH
    MOV PRT1MX,#00H
    MOV PCON,#80H
    MOV SCON,#70H
    MOV TMOD,#20H
    MOV TH1,#0FDH
    CLR FLAG

    SETB TR1
    SETB EA
    SETB ES

    CLR P2.5 ; GOT MAIN INITIALLY
    CLR P2.6
    MOV A,#038H
    CALL STROBE
    MOV A,#0CH
    CALL STROBE
    MOV A,#06H
    CALL STROBE
    MOV A,#01H
    CALL STROBE
    MOV A,#02H
    CALL STROBE

    SETB P2.5
    MOV DPTR,#MSG

    NEXT: CLR A
    MOVC A,@A+DPTR
    ANL A,#01111111B
    CJNE A,#0DH,LOOP
    JMP HERE

    LOOP: CALL STROBE
    INC DPTR
    JMP NEXT

    HERE: JMP HERE

    STROBE: SETB P2.7
    MOV P1,A
    CALL DELAY
    CLR P2.7
    RET
    CLR P2.5 ;Send command
    CLR P2.6 ;Write command
    LCALL STROBE
    SETB P2.5
    RET
    ;--------END OF SETTING-------------------

    ;--------DELAY----------------------------
    DELAY: MOV R0,#10H
    AA: MOV R1,#55H
    BB: DJNZ R1,BB
    DJNZ R0,AA
    RET
    ;------ END OF DELAY ---------------------

    ;-------- PHRASE STORAGE------------------
    ORG 600H
    DB '',0DH
    ;-------- END OF PHRASE STORAGE ----------

    ;RX1: MOV R0,#30H ;Move to R0

    RX: SETB EA
    JNB flag,RX
    CLR EA
    CLR FLAG
    MOV A,SBUF
    ;JMP CLCD
    ;MOVC A,@A+DPTR
    ;CJNE A,#0DH,CLCD
    ;INC DPTR
    CALL STROBE

    ;LCALL STROBE
    ;LCALL CLCD
    ;LCALL PRINTN
    ;MOV @R0,A
    ;INC R0
    ;CJNE R0,#03FH,RX
    ;MOV P1, #00H
    CLR ERR_FLG
    ;MOV R1, #30H

    LOOP1: CJNE @R1, #55H, SET_FLG

    BACK: INC R1
    CJNE R1,#3FH, LOOP1
    JNB ERR_FLG,SKIP
    MOV P1, #0FFh
    SKIP: JMP $

    SET_FLG:SETB ERR_FLG
    JMP BACK

    serial_isr: SETB flag
    CLR RI
    RETI
    END
    I interface with what i had received to the LCD and it does not result in the LCD. Also i probe an oscilloscope to transmit pin there is signal but not the receive pin. Can the error be in this receiving part??

  • CAN any one help??? i really need help on transmitting and receiving string.. really

  • "CAN any one help???"

    Not if you don't answer the questions!

  • "CAN any one help???"

    Not if you don't answer the questions!

  • Have you read Application Note 161 Interface and Simulation of an LCD Text Display

    http://www.keil.com/appnotes/docs/apnt_161.asp

    You can use this to run your code in the simulator, to check if your code is correct.

    If the Simulator shows that your code is correct, but it still doesn't work in your target, that suggests that you have a hardware fault - although it could just be that the simulator does not quite simulate your particular device correctly... ;-)