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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/06/01 07:13
Read: times


 
#7896 - RE: Serial port and basic
Shifting bits in BASIC:

Mathematically you can accomplist a shift left binary by multiplying a number by 2. To shift a 0 in, multiply the last number by 2 and add 0 (the add is unnecessary). To shift a 1 in, multiply the last nubmer by 2 and add 1.

If you want to shift bits in by character strings you might look up the word concatenate. Storing bits as characters is actually storing them as 8 bits (an ascii character). If you want to collect more information (ie bits) then collect them in a buffer in binary form, and when the buffer is full, dump them to your terminal and at that time, convert them from binary to a character basis.

Remember that a byte's bit positions represent:
Bit 7: 2^7 =128,
Bit 6: 2^6 =64,
Bit 5: 2^5 =32,
Bit 4: 2^4 =16,
Bit 3: 2^3 =8,
Bit 2: 2^2 =4,
Bit 1: 2^1 =2,
Bit 0: 2^0 =1

Pseudocode to convert a byte to print characters:

for i=7 to 0 step -1 {
.if BYTE-2^i >= 0 {
..print 1
..BYTE = BYTE-2^i }
.else {
..print 0 }
}

Or something close to that. :)

aka j

List of 48 messages in thread
TopicAuthorDate
IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
for aka j            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
4 kelvin            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
4 taylor            01/01/70 00:00      
4 aka j            01/01/70 00:00      
4 rauf            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
4 kelvin            01/01/70 00:00      
4 eric            01/01/70 00:00      
SFH506-36 works oke...            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: 4 aka j            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
for eric            01/01/70 00:00      
for steve            01/01/70 00:00      
for steve            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: Serial port and basic            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: Talk to a Chinese in Chinese......            01/01/70 00:00      
RE: a correction....            01/01/70 00:00      
RE: a correction....            01/01/70 00:00      
RE: a correction....            01/01/70 00:00      
for Simon            01/01/70 00:00      
RE: Talk to a Chinese in Chinese......            01/01/70 00:00      
RE: Talk to a Chinese in Chinese......            01/01/70 00:00      
RE: for aka j            01/01/70 00:00      
RE: IR please help...            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
RE: for aka j            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
RE: for Daxx teryn            01/01/70 00:00      
IR help            01/01/70 00:00      
2nd serial port by software            01/01/70 00:00      
RE: 2nd serial port by software            01/01/70 00:00      
RE: 2nd serial port by software            01/01/70 00:00      

Back to Subject List