Decompose VARIABLE

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

Moderator: Benj

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

Decompose VARIABLE

Post by Genilsonsa »

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

Post by Genilsonsa »

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

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Decompose VARIABLE

Post by LeighM »

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 = VAR16
BYTE_HIGH = VAR16 >> 8
Then you can save the two bytes to EEPROM
To get your UINT back

Code: Select all

VAR16 = (BYTE_HIGH << 8) + BYTE_LOW

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

Re: Decompose VARIABLE

Post by Genilsonsa »

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
:D

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

Re: Decompose VARIABLE

Post by Genilsonsa »

Thank you LeighM managed to decompose and reassembly of the variable.Thank you even
Attachments
decompor 16 bits.fcf
(11 KiB) Downloaded 305 times

Post Reply