×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

assembly language terms

assembly language terms

assembly language terms

(OP)
i currently doing a project on microcontroller 8031 and testing a program 'pulse width measurement' from a book "the 8051 microcontroller architecture, programming, and application"... but i don't understand the terms least significant bytes and most significant byte...some one can help...i can post the source code ....pls help tq..

RE: assembly language terms

16 bits are broken up into 2 bytes (each 8 bits long).  The least signifigant byte contains the lower 8 bits while the most signifigant byte contains the upper 8 bits.

RE: assembly language terms

(OP)
thank you for your reply melone,
but i still very blur by what kind of information is stored inside the P1 and P2 in the below program code....

.equ wflg,00h        ;bit flag used to notify main program
.org 0000h
mov sp,#30h          ; set stack above bit addreeable area
sjmp over            ;jump over INT1 interrupt area

;place /INT1 interrupt routine here
.org 13h
jb int1,noise        ;if not low then noise --leave
jbc tr1,stop         ;if T1 is running then stop it
setb tr1             ;if T1 is notrunning then start it

noise:
    reti            ;return with T1 enabled to time pulse

stop:
    setb wflg       ;set flag to indicate measurement done
    clr ex1         ;disable INT1 until next measurement
    reti            ;return with T1 stopped and wflg set

;the main program is placed here. the program monitors wflg and display the high pulse width on P1 (LSBY) and P2 (MSBY).
;the width is accurate to the nearest microsecond

over:
     mov tmod,#90h   ;T1 to count when INT1 pin high
     setb it1        ;INT1 interrupt on negative edge
     mov tl1,#00h    ;reset T1 to 00h
     mov th1,#00h
     mov ie,#84h     ;enable global and INT1 interrupts

simulate:
     jbc wflg,getwidth  ; test flag til measurement made
     sjmp simulate     ; loop til finish

getwidth:
     mov p1,tl1      ;display LS Byte on P1
     Mov p2,th1      ;display MS byte on P2
     sjmp over
     .end

so in the last part of the code in the "getwidth" part...how the pulse width in milisecond can be save into P1 (port 1)and P2(port2)...i mean in what form...let's say for example pulse width with 45.6milisecond...how it gonna to be kept in the MSB and LSB onto P1 and P2? help, anyone..

cheers,
bok



RE: assembly language terms

Hi, assuming you are counting in 1us. Then 45.6ms = 45,600 counts,as the counter is a binary this results in a a hex count of 0xb220. So p2 will have 0xb2 and p1 will have 0x20.

RE: assembly language terms

(OP)
hi, thank you for your reply...but can you please give me a few example... such as like 240ms = 240,000us = 3a890H so what is the Msb and Lsb, is that the Msb=3a and LSB= 90..is this the answer? thank you for your helps...
thanks,
bok

RE: assembly language terms

Hi, the counter is only 16 bit therefore you can only count up to 0xffff thats 65535 decimal.If you count more then the counter overflows and counts from zero.so if you try to count 240000 ie hex 0x3a980 then you only keep the lower 16 bits ie 0xa980, so p2 will have 0xa9 and p1 will have 0x80.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources