Assembly_7segment_counter

Embedded Systems Topics
User avatar
Nandika
Captain
Captain
Posts: 247
Joined: Sat Oct 15, 2011 11:40 am
Location: Galle-Sri Lanka

Re: Assembly_7segment_counter

Post by Nandika » Thu May 17, 2012 6:01 pm

Thank you Hasula,
It is small and nice answer. :D
I will want your help....
User avatar
Nandika
Captain
Captain
Posts: 247
Joined: Sat Oct 15, 2011 11:40 am
Location: Galle-Sri Lanka

Re: Assembly_7segment_counter

Post by Nandika » Thu May 17, 2012 6:12 pm

Thank you,
nice answer...
SemiconductorCat wrote: Is these things so hard to read and understand ?
I can understand.Nothing problem. :)

I want some small explanation about C bit of STATUS register.
SemiconductorCat wrote: C means carry bit, if your arithmetic instruction will carry [for a example add 0xFF to 1,
example

Code: Select all

movlw 0xff
addlw 0x01
Then carry bit will be one.
At what time will this bit become 0(clear)?give me a small example.

Thank you
User avatar
SemiconductorCat
Major
Major
Posts: 455
Joined: Mon Aug 22, 2011 8:42 pm
Location: currently in hyperspace

Re: Assembly_7segment_counter

Post by SemiconductorCat » Thu May 17, 2012 6:21 pm

>> At what time will this bit become 0(clear)?give me a small example.

If your addition or subtraction operation like ( ADDLW , SUBLW etc ...) will product a result don't produce a carry.

ex:

Code: Select all

   MOVLW  0x01
   ADDLW   0x01
Where we load the register with 1 and , add with another 1.


To understand carry, you have to go back to and find out how a ripple adder works.
http://en.wikipedia.org/wiki/Adder_(electronics)

So when your arithmetic operation does not produce a carry out from the register , that bit will be cleared out.


Every arithmetic instruction will update those flags , Z , C and DC. So if you need to use these bits
you have to do it right just after that arithmetic instruction.

The status of those bits ,just after you turn on microcontroller is defined in the manual clearly.
It may be 1, 0, undefined or high Z status. (where high Z referred to high impedance state).

Bellow figure describes the different values of bits in registers , just after power on, reset and
wake from sleep.
Image

Now you could learn to read the manual.
Post Reply

Return to “Embedded Systems”