Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/14/12 16:13
Read: 667 times


 
#186672 - serial Tx code
Responding to: Stefan Kanev's previous message
I am using the following bit of code. since I knew that serialangle was going to vary between -20 to +20 I added 20 to my code in order to see the negative numbers, therefore my zero is actually 20. And I also multiplied it by 10 to see one number after the decimal point.
What was actually being seen on my PC when serialangle was going negative the would show a constant 40 through all negative numbers of serialangle.

        serialangle = (serialangle +20) * 10;

        units = (serialangle % 10) | 0x30;
	a = serialangle/ 10;
	tens = (a%10) | 0x30;
	b = a / 10;
	hundreds = (b % 10)|0x30;
	c = b / 10;
   	thousands = (c % 10)|0x30;
	d = c / 10;
	thousands2= (d % 10)|0x30;
	thousands3= d / 10;
	thousands3= (thousands3 % 10)|0x30;
	SrTx(thousands3);
	SrTx(thousands2);
	SrTx(thousands);
	SrTx(hundreds);
	SrTx(tens);
	SrTx(0x2E);				// decimal point
	SrTx(units);
	SrTx(0x0A); 	  //space
	SrTx(0x0D); 	  //space
 


List of 19 messages in thread
TopicAuthorDate
I'm having problems calculating negative float values      Jeremy Vella      03/14/12 12:26      
   float values?      Erik Malund      03/14/12 13:11      
      65536 no      Anders Sandström      03/14/12 14:29      
      negative float numbers      Jeremy Vella      03/14/12 14:38      
         Two comparisons      Per Westermark      03/14/12 15:06      
         Insufficient justification      Andy Neil      03/16/12 00:12      
            re:insufficient justification      Jeremy Vella      03/16/12 02:45      
   how are numbers transmitted?      Stefan KAnev      03/14/12 15:49      
      serial Tx code      Jeremy Vella      03/14/12 16:13      
         Data type?      Per Westermark      03/14/12 19:41      
         Data type?      Per Westermark      03/14/12 19:41      
            serialangle data type      Jeremy Vella      03/15/12 02:43      
               Just a question of readability      Per Westermark      03/15/12 02:54      
                  re: just a question of readability      Jeremy Vella      03/15/12 04:08      
               why do you keep babbeling about 'float'      Erik Malund      03/15/12 07:59      
                  float reason      Jeremy Vella      03/15/12 08:30      
                     fixed point        Maarten Brock      03/15/12 08:54      
                        re:fixed point      Jeremy Vella      03/15/12 18:16      
               typecast      Stefan KAnev      03/15/12 08:07      

Back to Subject List