CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

high and low nibble
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

nibble
PostPosted: Sun Jul 04, 2010 9:14 pm     Reply with quote

humberto

00010011 & 0x0F (11110000) result 00010000 (16 dec).

Could you explain this math?

tks

nina
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Jul 05, 2010 9:29 am     Reply with quote

Quote:

I am not using 7445. Display one and display two are conected directly to pic. How can I display those numbers?

Use this table assignment to drive each segment of the display directly from the PIC:
Code:
//          character         0    1    2    3    4    5    6    7    8    9
byte const Digit_Map[10] = {0xFC,0x60,0xDA,0xF2,0x66,0xB6,0xBE,0xE0,0xFE,0xE6};

Wire the MSB of the selected port (Ex PortB: B7 to segment a, B6: seg b, B5: seg c ... B1:seg g)

Quote:

00010011 & 0x0F (11110000) result 00010000 (16 dec).
Could you explain this math?

I never post what you remark.

Binary 0b11110000 is equal to HEX 0xF0 NOT 0x0F as you post.

x = 0x13 & 0xF0 // in HEX
x = 0b000100011 & 0b11110000 // in Binary

AND two binary values
0b00010011 // 0x13
0b11110000 // 0xF0
____________
0b00010000 // 0x10

Please use MPLAB to test and simulate all this math.

Humberto


Last edited by Humberto on Mon Jul 05, 2010 10:33 am; edited 1 time in total
nina



Joined: 20 Apr 2007
Posts: 111

View user's profile Send private message Send e-mail

nibble
PostPosted: Mon Jul 05, 2010 10:18 am     Reply with quote

humberto

binary 0b00010000 is not 16 in dec? This point I can not understand.


bin dec hex
0000 0001 01 01
0001 0000 16 10

Tks

nina
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Jul 05, 2010 10:54 am     Reply with quote

0b000100000 YES it is equal to decimal 16.

I showed you how to handle a binary number >100 using a single algoritm to convert it to BCD
in two nibbles. These two nibbles does not have any mathematical equivalent to any Decimal number,
just is a BCD value that can not be used for any math. I guess that this is what you do not figure out.
Once converted a binary value, the resulting value to drive a display segments, like 0b000100000
does not matter if is equal to a decimal number, it´s just a value that will do what you need.

Humberto
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group