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

code works in simulation not on chip

hi, my first project on uvision but im having trouble making it work. so I'm making a simple POV toy (leds flash and moving it side to side you see a message) using a Atmel AT89S52 microcontroller, with 8 leds connected to its port 2.

i know my programmer and board is working because i made a simple program to toggle leds in port 2 and it work fine.

programmer i using is based on this:
http://ikalogic.com/isp.php

im using the latest version of the software and I added leds on it to see if programs work.

Parents
  • ;**************SPACE SUBROUTINE****************************
    SPACE:                  MOV P2, #0FFH                           ;OUTPUT A SPACE
                                    ACALL DELAY                                     ;CALL A DELAY BEFORE NEXT ONE
    
    RET
    
    ;*******************DELAY SUBROUTINE*******************
    DELAY:                  MOV R4, #0FFh
    NEXT:                   MOV R5, #0FFh
    AGAIN:                  DJNZ R5, AGAIN
                            DJNZ R4, NEXT
    RET
    
    ;*********************MESSEGE TO BE SENT OUT*********************
    ;ONLY CHANGE WHAT IS INSIDE OF THE "", THE 0 IS TO SIGNIFY THE END.
    
    MESSEGE:        DB "HELLO", 0
    
    ACHAR:          DB 11100000B , 10010111B , 01110111B , 10010111B , 11100000B , 01010101B
    BCHAR:          DB 00000000B , 01101110B , 01101110B , 01101110B , 10010001B , 01010101B
    CCHAR:          DB 11000011B , 10111101B , 01111110B , 01111110B , 10111101B , 01010101B
    DCHAR:          DB 00000000B , 01111110B , 01111110B , 10111101B , 11000011B , 01010101B
    ECHAR:          DB 00000000B , 01101110B , 01101110B , 01101110B , 01101110B , 01010101B
    FCHAR:          DB 00000000B , 01101111B , 01101111B , 01101111B , 01101111B , 01010101B
    GCHAR:          DB 10000001B , 01111110B , 01110110B , 01110001B , 10110111B , 01010101B
    HCHAR:          DB 00000000B , 11101111B , 11101111B , 11101111B , 00000000B , 01010101B
    ICHAR:          DB 01111110B , 01111110B , 00000000B , 01111110B , 01111110B , 01010101B
    JCHAR:          DB 01111101B , 01111110B , 00000001B , 01111111B , 01111111B , 01010101B
    KCHAR:          DB 00000000B , 11100111B , 11011011B , 10111101B , 01111110B , 01010101B
    LCHAR:          DB 00000000B , 11111110B , 11111110B , 11111110B , 11111110B , 01010101B
    MCHAR:          DB 00000000B , 10111111B , 11011111B , 10111111B , 00000000B , 01010101B
    NCHAR:          DB 00000000B , 10011111B , 11101111B , 11110011B , 00000000B , 01010101B
    OCHAR:          DB 00000000B , 01111110B , 01111110B , 01111110B , 00000000B , 01010101B
    PCHAR:          DB 00000000B , 01101111B , 01101111B , 01101111B , 00001111B , 01010101B
    QCHAR:          DB 11000011B , 10111100B , 01111010B , 10111101B , 10000010B , 01010101B
    RCHAR:          DB 00000000B , 01100111B , 01101011B , 10101011B , 11011100B , 01010101B
    SCHAR:          DB 10010011B , 01101110B , 01101110B , 01101101B , 10110011B , 01010101B
    TCHAR:          DB 01111111B , 01111111B , 00000000B , 01111111B , 01111111B , 01010101B
    UCHAR:          DB 00000001B , 11111110B , 11111110B , 11111110B , 00000001B , 01010101B
    VCHAR:          DB 00001111B , 00001100B , 11111100B , 11110011B , 00001111B , 01010101B
    WCHAR:          DB 00000001B , 11111100B , 11111011B , 11111100B , 00000001B , 01010101B
    XCHAR:          DB 00011000B , 11100111B , 11111111B , 11100111B , 11100111B , 01010101B
    YCHAR:          DB 01111111B , 10111111B , 11000000B , 10111111B , 01111111B , 01010101B
    ZCHAR:          DB 01111110B , 01111000B , 01100110B , 00011110B , 01111110B , 01010101B
    
    END
    
    

Reply
  • ;**************SPACE SUBROUTINE****************************
    SPACE:                  MOV P2, #0FFH                           ;OUTPUT A SPACE
                                    ACALL DELAY                                     ;CALL A DELAY BEFORE NEXT ONE
    
    RET
    
    ;*******************DELAY SUBROUTINE*******************
    DELAY:                  MOV R4, #0FFh
    NEXT:                   MOV R5, #0FFh
    AGAIN:                  DJNZ R5, AGAIN
                            DJNZ R4, NEXT
    RET
    
    ;*********************MESSEGE TO BE SENT OUT*********************
    ;ONLY CHANGE WHAT IS INSIDE OF THE "", THE 0 IS TO SIGNIFY THE END.
    
    MESSEGE:        DB "HELLO", 0
    
    ACHAR:          DB 11100000B , 10010111B , 01110111B , 10010111B , 11100000B , 01010101B
    BCHAR:          DB 00000000B , 01101110B , 01101110B , 01101110B , 10010001B , 01010101B
    CCHAR:          DB 11000011B , 10111101B , 01111110B , 01111110B , 10111101B , 01010101B
    DCHAR:          DB 00000000B , 01111110B , 01111110B , 10111101B , 11000011B , 01010101B
    ECHAR:          DB 00000000B , 01101110B , 01101110B , 01101110B , 01101110B , 01010101B
    FCHAR:          DB 00000000B , 01101111B , 01101111B , 01101111B , 01101111B , 01010101B
    GCHAR:          DB 10000001B , 01111110B , 01110110B , 01110001B , 10110111B , 01010101B
    HCHAR:          DB 00000000B , 11101111B , 11101111B , 11101111B , 00000000B , 01010101B
    ICHAR:          DB 01111110B , 01111110B , 00000000B , 01111110B , 01111110B , 01010101B
    JCHAR:          DB 01111101B , 01111110B , 00000001B , 01111111B , 01111111B , 01010101B
    KCHAR:          DB 00000000B , 11100111B , 11011011B , 10111101B , 01111110B , 01010101B
    LCHAR:          DB 00000000B , 11111110B , 11111110B , 11111110B , 11111110B , 01010101B
    MCHAR:          DB 00000000B , 10111111B , 11011111B , 10111111B , 00000000B , 01010101B
    NCHAR:          DB 00000000B , 10011111B , 11101111B , 11110011B , 00000000B , 01010101B
    OCHAR:          DB 00000000B , 01111110B , 01111110B , 01111110B , 00000000B , 01010101B
    PCHAR:          DB 00000000B , 01101111B , 01101111B , 01101111B , 00001111B , 01010101B
    QCHAR:          DB 11000011B , 10111100B , 01111010B , 10111101B , 10000010B , 01010101B
    RCHAR:          DB 00000000B , 01100111B , 01101011B , 10101011B , 11011100B , 01010101B
    SCHAR:          DB 10010011B , 01101110B , 01101110B , 01101101B , 10110011B , 01010101B
    TCHAR:          DB 01111111B , 01111111B , 00000000B , 01111111B , 01111111B , 01010101B
    UCHAR:          DB 00000001B , 11111110B , 11111110B , 11111110B , 00000001B , 01010101B
    VCHAR:          DB 00001111B , 00001100B , 11111100B , 11110011B , 00001111B , 01010101B
    WCHAR:          DB 00000001B , 11111100B , 11111011B , 11111100B , 00000001B , 01010101B
    XCHAR:          DB 00011000B , 11100111B , 11111111B , 11100111B , 11100111B , 01010101B
    YCHAR:          DB 01111111B , 10111111B , 11000000B , 10111111B , 01111111B , 01010101B
    ZCHAR:          DB 01111110B , 01111000B , 01100110B , 00011110B , 01111110B , 01010101B
    
    END
    
    

Children
  • so im using c51 to output a hex file and the programmer software to flash the chip, but after i flashed it no leds light up it just does nothing.

    i made a project and i tried it with and without a start-up code. is there something i have to do with the start up code? it just copied it in the folder and i left it there.

    anyway, can any one help me? im soo confused i got no errors or warnings on my code and it works in the simulation but when i flash it, nothing happens.