## Decompose VARIABLE

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

### Decompose VARIABLE

Ola friends I am trying to make a project with microcontroller PIC 16F877 and this project consists in record a number in the eeprom foreign 24c08,number as these 2600 until 2660 and then make the comparison if the numbers are certain,but doing test with the own internal microcontroller eeprom VI that the maximum that supports each address is 255 or 0xff.Like decompose these numbers for example in two variable .Vc can I explain how this works

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

### Re: Decompose VARIABLE

I would like to decompose an undefined variable value 2660 and put into 2 variable and write to EEPROM foreign.If you want to check if this value is there in the EEPROM I get the variable and remonto.My doubt is how I do this decomposition and reassembly of variable .someone can help me

LeighM
Matrix Staff
Posts: 2008
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 480 times
Been thanked: 688 times
Contact:

### Re: Decompose VARIABLE

Hi
If you say have a UINT variable VAR16, this can be split into two BYTE variables, BYTE_HIGH and BYTE_LOW

Code: Select all

`BYTE_LOW = VAR16BYTE_HIGH = VAR16 >> 8`

Then you can save the two bytes to EEPROM

Code: Select all

`VAR16 = (BYTE_HIGH << 8) + BYTE_LOW`
These users thanked the author LeighM for the post (total 2):
STibor (Thu Feb 18, 2016 9:12 pm) • medelec35 (Fri Feb 19, 2016 12:54 pm)
Rating: 10%

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

### Re: Decompose VARIABLE

LeighM Thank you for answer me and at the same time lighten my mind.Was with doubt and you answered me so clearly.Thank You

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

### Re: Decompose VARIABLE

Thank you LeighM managed to decompose and reassembly of the variable.Thank you even
Attachments
decompor 16 bits.fcf