Welcome to the VirtuQ Forums.
Results 1 to 13 of 13

Hybrid View

  1. #1

    Serial Communication

    Hi,

    MOV TMOD ,#20H
    MOV TH1,#-6 ; to set baud rate to 4800
    MOV SCON,#50H
    SETB TR1
    AGAIN: MOV SBUF,#'A'
    HERE: JNB TI,HERE
    SJMP AGAIN
    END
    It displays error:

    Compiling file: s13.asm
    Initializing pre-processor ...
    Notice at 2 in s13.asm: Overflow `-6' -> `65530'
    Syntax error at 2 in s13.asm: Operand value out of range: `-6' (`65530')
    Pre-processing FAILED !
    Creating code listing file ... -> "s13.lst"
    1 error, 0 warnings
    Please guide.

    Thanks,
    Anon10457

  2. #2
    Hi,

    Please give a hint to the above error.

    Thanks,
    Anon10457

  3. #3
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    The compiler is clearly saying what is wrong. What other hint do you expect from us?

    -- Basant

  4. #4
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    Probably assembler doesn't like '-6'. Try giving hex equivalent.

    -- Basant

  5. #5
    Hi,
    In the sample code below it keeps on looping
    ORG 00H
    JMP MAIN
    MAIN:
    MOV TMOD,#20H
    MOV SCON,#50H
    MOV TH1,#0FDH
    SETB TR1
    AGAIN: MOV SBUF,#'A'
    HERE: JNB TI,HERE
    CLR TI
    SJMP AGAIN
    END
    As value reaches to 655021 it keeps on looping infinite to
    655021--655022--655023--655021again.
    Where am I making mistake?

    Thanks
    Anon10457

  6. #6
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    Can you explain your observations more? Are you referring to the inner loop and saying that inner loop (for label HERE) never terminates?

    -- Basant

  7. #7
    Hi,

    Yes, I am talking about the HERE loop only.

    Thanks,
    Anon10457

  8. #8
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    I will give it a shot in the evening. Code structure looks alright though.

    Thanks
    Basant

  9. #9
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    I ran this program. It works fine and comes out of the inner loop once the transfer is over. Set a breakpoint at 'CLR TI' and verify yourself.

    -- Basant

  10. #10
    Hi,
    May I know for how long it runs for you?

    Cos for me it is still in looping..655021--655022--655023--655021again.

    Thanks,
    Anon10457

  11. #11
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    You need to provide more information about your setup. The same program works for me, I am not sure what difference you have. Please provide the following information.
    • What is your MCU?
    • In which register you are seeing the values 65... and so on?
    • Did you set the breakpoint at 'CLR TI' instruction and verified whether it comes out of the loop?
    • Are you doing the experiment on your local machine or in VirtuQ lab?
    • Also show us the screenshot of your simulation run with a breakpoint as above?

    Thanks
    Basant

  12. #12
    Hi,


    • What is your MCU?
    • In which register you are seeing the values 65... and so on?
    • Did you set the breakpoint at 'CLR TI' instruction and verified whether it comes out of the loop?
    • Are you doing the experiment on your local machine or in VirtuQ lab?
    • Also show us the screenshot of your simulation run with a breakpoint as above?
    1. MCU 8051 IDE (AT89S52)
    2. Timer1 register. Values keeps on wandering and never comes out of the loop.
    3. Tried with breakpoints too, but it never comes out of the loop.
    4. I've tried on both, result is same.
    5. I've enclosed the screenshot.

    Thanks,
    Anon10457
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	mcu.jpg 
Views:	406 
Size:	124.1 KB 
ID:	475  

  13. #13
    VirtuQ Moderator
    Join Date
    Jun 2011
    Location
    Bangalore, India
    Posts
    310
    Blog Entries
    4
    Anon10457,

    For AT89S52 also, code works fine. I think that though you have set the breakpoint, you are just doing single stepping to see whether it comes out of the loop. Since the loop has to run for long time, you get the impression that it never comes out of the loop. In this case, if you do run (Simulator -> Run (F9) ), it should reach the breakpoint. Further, just looking at the timer value is not going to help as you have set it up in auto-reload mode. That is why you keep seeing the same values.

    I don't have any further inputs to give on your program. The program as such is fine, but you are not running the simulation correctly.

    -- Basant


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •