grasshopper
05-22-2008, 11:25 PM
Basically i am trying to take an array that a user can change by storing a baud rate in EEPROM. My problem is that if i add up the string that the user inputs i can seem to get it to be a correct value.
here is an example if a user inputs 9600
FLASH[ 2 ] := ((RxString[ 9 ] * 1000) + (RxString[ 10 ] * 100) + ( RxString[ 11 ] * 10) + (RxString[ 12 ]))
In the code the array Flash[ 2 ] is where i would expect to find 9600 logicaly i thought adding RxString [ 9 - 12] but it is not the case
9600 where the 9 is RxString[ 9 ] and the 6 is RxString[ 10 ] and the 0 is RxString [ 11 ] and the 0 is RxString [ 12 ]
My other foreseeable problem is that if a user inputs a number 19200 then the code will have to be modified
FLASH[ 2 ] := ((RxString[ 9 ] * 10000) + (RxString[ 10 ] * 1000) + ( RxString[ 11 ] * 100) + (RxString[ 12 ] *10 ) + (RxString[ 12 ] ))
I could address this with an If statement but some help would be nice
here is an example if a user inputs 9600
FLASH[ 2 ] := ((RxString[ 9 ] * 1000) + (RxString[ 10 ] * 100) + ( RxString[ 11 ] * 10) + (RxString[ 12 ]))
In the code the array Flash[ 2 ] is where i would expect to find 9600 logicaly i thought adding RxString [ 9 - 12] but it is not the case
9600 where the 9 is RxString[ 9 ] and the 6 is RxString[ 10 ] and the 0 is RxString [ 11 ] and the 0 is RxString [ 12 ]
My other foreseeable problem is that if a user inputs a number 19200 then the code will have to be modified
FLASH[ 2 ] := ((RxString[ 9 ] * 10000) + (RxString[ 10 ] * 1000) + ( RxString[ 11 ] * 100) + (RxString[ 12 ] *10 ) + (RxString[ 12 ] ))
I could address this with an If statement but some help would be nice