Go Down

### Topic: [SOLVED]splitting int to print each value to 7seg (Read 2110 times)previous topic - next topic

#### grendle

##### Jan 21, 2013, 03:47 amLast Edit: Jan 21, 2013, 04:19 am by grendle Reason: 1
hi folks, checked everywhere for this, for a long time now. checked here and the reference, experimented with highbyte, lowbyte etc. example, using max7219, wanting to take a value say "24" split it to write "2" to one segment, and "4" to the other. thanks.

Code: [Select]
`int =24Serial.print((a/10)%10);Serial.print(a%10);`

results = a "2" and a "4".

#1
##### Jan 21, 2013, 03:57 am
You've got a couple things there.

24 in decimal is 0x0018, so highbyte & lowbyte will give 0x00 and 0x18, not really what you want.

If you use the modulo command I think you can split 24 decimal into 2 and 4.

Then its just a matter sending the data to the appropriate registers in the MAX7219.
I believe register 1 would be digit 0 for the 4, and register 2 would be digit 1 for the 2 in your example.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### grendle

#2
##### Jan 21, 2013, 04:01 amLast Edit: Jan 21, 2013, 04:24 am by grendle Reason: 1
ok great thanks! back to work now lol. ya the 7219 is working fine no issues where to send the values, just need to split it. let me start thx again.

hmm looks like modulo just does division? still messin with it. NOPE  that did it. thank you. works fine, ez too. solution in op.

Go Up