CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Assembly
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Assembly Questions and Answers for Assembly here!

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old October 25th, 2004, 01:59 AM
    hkboy313 hkboy313 is offline
    Junior Member
     
    Join Date: Oct 2004
    Posts: 17
    hkboy313 is an unknown quantity at this point (<10)
    update...can anybody answer this? help on programming

    hi again..hopefully i am somewhere along the lines of 'close'

    i wont tell the program objectives...but i made prg that works actually

    but donno whatthe outputs mean... here is the program

    #include <8051io.h>
    #include <8051bit.h> /* Bit set/clear macros */
    #include <8051reg.h>

    void main()
    {
    int i;
    serinit(9600);
    asm
    {
    MOV TMOD,#10H
    MOV TL1,#047H
    MOV TH1,#0FFH
    }
    for(i=0; i<1; i++)
    printf( "\nTimer=%d %d", TH1, TL1 );
    }

    the output is Timer=253 254


    however if i change the timer to 0 which is TMOD,#01
    and the printf( TH0, TL0); then i get this output Timer=255 71

    can anybody explain what is this number mean? is it frequency? square wave signal? please help... thanks ...
    Reply With Quote
      #2    
    Old October 25th, 2004, 02:31 AM
    bigBA's Avatar
    bigBA bigBA is offline
    Member +
     
    Join Date: May 2004
    Location: Germany
    Posts: 649
    bigBA is a jewel in the rough (200+)bigBA is a jewel in the rough (200+)bigBA is a jewel in the rough (200+)
    Re: maybe c++ people can help me? i posted in assembly too...

    well... a timer with microprocessor programming is (simply) a counter, which can (depends on the controller type) count up or downwards, with a desired (depends also on the controller type) frequency, often a multiple of the controllers frequency.
    on overflow it will generate an interrupt, then you know, chosen time is over.

    so i think (don't know anything about the 8051) that TL1 and TH1 are in fact the two halfs of the 16bit count register for the timer1.

    so what your printf does is outputting the actual position of your timer.

    its not a frequency, nor a square wave signal... its only the position of your counter.
    example: if one count operation took 1 second and you want to wait 10 seconds. you set your timer register to 10 (if it counts downwards). if the register reaches 0, 10 seconds are over.
    __________________
    there are 10 kinds of people. those who understand binary and those who don't...

    rate a post if you find it usefull, thx
    check out my Firefox/Mozilla Extension: http://urlparams.blogwart.com/
    Reply With Quote
      #3    
    Old October 25th, 2004, 08:10 AM
    TSYS TSYS is offline
    Senior Member
     
    Join Date: Oct 2002
    Posts: 1,133
    TSYS has a spectacular aura about (100+)TSYS has a spectacular aura about (100+)
    Re: maybe c++ people can help me? i posted in assembly too...

    You'll have to explain what TMOD, TL1 and TH1 are. If I assume TL1 and TH1 are the low- and high-order bytes of a 16-bit word, then your first printed result, "253 254", corresponds to the 16-bit value FDFE, or -514. The second printed value, "255 71" corresponds to the 16-bit value FF47, or -185.

    Who knows what these numbers mean? Your question provides no clues whatsoever.
    __________________
    Regards
    Robert Thompson
    Reply With Quote
      #4    
    Old October 25th, 2004, 12:55 PM
    hkboy313 hkboy313 is offline
    Junior Member
     
    Join Date: Oct 2004
    Posts: 17
    hkboy313 is an unknown quantity at this point (<10)
    Re: maybe c++ people can help me? i posted in assembly too...

    would you mind giving me an example of a square wave signal ? thank you again.
    Reply With Quote
      #5    
    Old October 25th, 2004, 01:02 PM
    Andreas Masur Andreas Masur is offline
    Moderator
    Power Poster
     
    Join Date: May 2000
    Location: KY, USA
    Posts: 18,610
    Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)Andreas Masur has a brilliant future (2000+)
    Re: update...can anybody answer this? help on programming

    [ Merged threads ]
    __________________
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)
    Reply With Quote
      #6    
    Old October 26th, 2004, 03:45 AM
    bigBA's Avatar
    bigBA bigBA is offline
    Member +
     
    Join Date: May 2004
    Location: Germany
    Posts: 649
    bigBA is a jewel in the rough (200+)bigBA is a jewel in the rough (200+)bigBA is a jewel in the rough (200+)
    Re: update...can anybody answer this? help on programming

    what do you mean by "giving a example of a square wave signal"?

    should i draw you a picture? *justjoking*

    look at the other thread started by you... i gave an answer
    __________________
    there are 10 kinds of people. those who understand binary and those who don't...

    rate a post if you find it usefull, thx
    check out my Firefox/Mozilla Extension: http://urlparams.blogwart.com/
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Assembly


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 10:28 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009