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??

  • What use is putting "hi" as the Summary of your message?
    In what way does that summarise your question?!
    How will that help anyone looking at the list of subjects?

  • "i have done it but then it is not receving what i had transmitted"

    Is it receiving anything at all?

    If it receives something, what's wrong with it?

    "...what is the problem??"

    Your code is wrong.

    Without seeing your code, how on earth can we tell you what the problem is!?

    What steps have you taken to degug this yourself?
    Have you tried it in the Simulator?

    "but can any give me a guide or source??"

    There are loads of examples on this site & in your Keil installation!

  • flag bit 00H

    ORG 0000H
    JMP CONFIG
    ORG 23H

    ORG 0100H
    HEAD EQU 300H ;-> Starting address of the messages
    ORG 0100H

    ;-------------------------------------
    ;--------------LCD SETUP--------------
    ;-------------------------------------
    CONFIG: NOP
    NOP
    NOP
    MOV OSCXCN,#0E7H ;> SETTING FOR EXTERNAL OSCILLATOR CONTROL
    NOP
    NOP
    NOP
    NOP
    ORL OSCXCN,#00H ;-> POLL FOR XTLVLD '0' TO '1' TO SWITCH TO EXTERNAL OSCILLATOR
    NOP
    NOP
    MOV OSCICN,#08H ;-> INTERNAL OSCILLATOR OFF
    NOP
    NOP

    MOV PRT0CF,#03H ;-> PORT 0 CONFIG -
    MOV P0MODE,#0FFH ;-> PORT 0 MODE REGISTER - DIGITAL INPUT IS ENABLE
    MOV PRT0MX,#01H ;-> PORT 0 MUX CONFIG REGISTER - UART I/O ENABLE FOR TX & RX
    MOV P0,#0FCH ;-> PORT 0 REGISTER -

    MOV PRT1CF,#0FFH ;-> PORT 1 CONFIG - OUTPUT MODE SET AS PUSH-PULL
    MOV P1MODE,#0FFH ;-> PORT 1 MODE REGISTER - DIGITAL INPUT IS ENABLE
    MOV P1,#0FFH

    MOV PRT2CF,#0E0H ;-> PORT 2 CONFIG - OUTPUT MODE SET AS PUSH-PULL
    MOV P2MODE,#0E0H ;-> PORT 2 MODE REGISTER - DIGITAL INPUT IS ENABLE
    MOV P2,#1FH

    MOV WDTCN,#0DEH
    MOV WDTCN,#0ADH

    CLR P2.5 ;Send command
    CLR P2.6 ;Write command
    MOV A,#38H ;??? font
    LCALL STROBE
    MOV A,#0CH ;Cursor off
    LCALL STROBE
    MOV A,#06H ;Display pattern
    LCALL STROBE
    MOV A,#01H ;Clear display
    LCALL STROBE
    MOV A,#02H ;Return home
    LCALL STROBE
    SETB P2.5 ;RS send data
    MOV DPTR,#HEAD
    ACALL MESS

    ;-------------------------------------
    ;--------Serial Communication---------
    ;-------------------------------------
    MOV PCON,#80H ;DOUBLE THE BAUD RATE BY SETTING SMOD TO 1
    MOV TMOD,#20H ;Set Timer 1 to 8 bits auto-reload timer
    MOV SCON,#70H ;Serial Port Control Register 8-bit UART
    MOV TH1,#0FDH ;9600bps * (SMOD+1) = 19200bps
    SETB TR1 ;Start the timer 1
    ;----------------------------------------
    ;-----------------MAIN PROGRAM-----------
    ;----------------------------------------

    ;MAIN: MOV DPTR,#HEAD
    ;ACALL MESS

    ;----------------------------------------
    ;------------TRANSMITTING STRING---------
    ;----------------------------------------

    Mess: ;PUSH ACC
    MOV R0,#0 ;R0 is character pointer (string
    MSS: MOV A,R0 ; length is to 256 bytes).
    MOVC A,@A+DPTR ;Get byte to send.
    CJNE A,#0DH,TX ;End of string is indicated by a 0DH.
    ;POP ACC


    CHECK: JNB TI,CHECK
    CLR TI
    CALL DELAY


    TX: MOV SBUF,A ;Send a character.
    INC R0 ;Next character.
    SJMP MSS
    JMP CHECK
    ;CALL DELAY
    ;WAIT: JNB TI,WAIT
    ;CLR TI
    ;INC DPTR

    ;-------------------------------------
    ;-----------Phrase Storage------------
    ;-------------------------------------

    ORG 300H
    DB 'HOW ARE YOU',0DH

    ;-------------------------------------
    ;----------DISPLAY IN LCD-------------
    ;-------------------------------------
    LCD: CLR A
    MOVC A,@A+DPTR
    CJNE A,#0DH,LOOP
    RET

    LOOP: LCALL STROBE
    INC DPTR
    LJMP LCD

    STROBE: SETB P2.7 ;Set E to high
    MOV P1,A ;Send to port 1
    LCALL DELAY
    CLR P2.7
    RET
    ;-------------------------------------
    ;-----------Standard DELAY------------
    ;-------------------------------------
    DELAY: MOV R6,#10H
    AA: MOV R7,#0EFH
    BB: DJNZ R7,BB
    DJNZ R6,AA
    RET

    END
    i tried to transmit the string and show it on the LCD at the same time but i don receive the same string on the LCD
    ( PC1604A-L 16x4 P-TEC ). IS the error in this program??

  • "i don receive the same string on the LCD"

    So what do you receive!?!
    What exactly is wrong with it?

    And what about the other questions I asked you:

    What steps have you taken to degug this yourself?

    Have you tried it in the Simulator?

  • 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... ;-)