A byte variable can store an integer number from 0 to 255.

westaust55

Moderator
Bits as 1 bit with values of 0 or 1
Nybbles as 4 bits with values from 0 to 15
Bytes as 8 bits with values from 0 to 255
Words as 16 bits with values from 0 to 65535
Are standard in the computing/IT world

there are also Long Words typically as 32 bits but maybe also as 64 bits.
 

Aries

New Member
As Westaust55 implies, the maximum integer value that can be stored is dependent purely on the number of bits available. FWIW, Univac had 36-bit words, and 72-bit "double words" (as they were known to us assembler programmers). As I recall, CDC had 60-bit words. So, the maximum value is chip (or "machine") dependent - and many chips still have 8 or 16 bits as their primary size.
 

papaof2

Senior Member
Many of the micros hobbyists use are 8 or 16 bits, although 32 bits are available and if you do research at the chip makers (ST, for example) you might even find some 64 bit micros. Obviously, those are more aimed at the industrial market than at hobbyists ;-) I have the "evaluation board" for one of the ST 32 bit micros and all the documentation and programming software - just another project to keep me out of trouble on a long, rainy weekend ;-)

Some things become "standards" by default: someone comes up with a design that works for Process X and someone else sees that the design could also work in their Project G and someone else uses it in their Project R and by then it's become a "standard" because it WORKS.

There is a huge amount of history in things as "simple" as displaying numbers and text characters - from Nixie tubes to 7 segment to 14 segment to dot matrix character displays to now graphic LCD and OLED displays.
 

AllyCat

Senior Member
Hi,
So I suppose all the micros are 8-bit.
Not really. Perhaps most MicroControllers (which is what PIC{axe} really is) or MicroProcessors are still 8-bits, but today most MicroComputers would use 16 , 32 or 64 bits. But the Byte remains the main unit of data storage. Why 8 bits? I don't really know, but it's a "convenient" number and one of the first storage media was (8-holes wide) Paper Tape, which happened to be exactly 1 inch wide, with 8 rows of data holes, plus a row of smaller index or drive holes. 7 rows give about 126 "characters" (plus blank tape, and 8-holes reserved for the "Delete(d)" character) i.e. ASCII code, plus one row for a Parity (check) bit.

Actually PICaxe is slightly unusual because it doesn't use negative numbers, so the maximum byte value is 255, i.e. the bits (or holes) represent the values (or have a "weight" of) 1 , 2 , 4 , 8 , 16 .... 128 which total 255 , and because Computer Engineers always start counting from zero (not 1). ;) However, many systems use the top bit as a "Sign bit" instead of representing 128, so their maximum positive integer value is 127. But as the 0 is in the set of "positive" numbers, it means that the largest negative number is actually -128 . It also means that a decrementing loop such as DO ... LOOP UNTIL b0 < 0 may actually work. :)

Although the "Base PIC" (hardware) is an 8-bit Controller, the PICaxe Operating System creates mainly a 16-bit "Arithmetic Logic Unit". Thus, if b1 has a value of say 200, then the expression b1 = b1 * b1 / b1 will still give the correct answer, even though the ALU always works from left to right and b1 * b1 greatly exceeds a value which can be stored in a single byte. Interestingly, the PICaxe Editor sometimes "understands" up to 31-bit numbers (because it's working on a 32-bit+ host) but not 32-bits, because that's the sign bit !

Cheers, Alan.
 

Buzby

Senior Member
See : https://jvns.ca/blog/2023/03/06/possible-reasons-8-bit-bytes/

The full text of the link is a bit long-winded, but the conclusion is summarised here ...

Its full capacity of 256 characters was considered to be sufficient for the great majority of applications.

Within the limits of this capacity, a single character is represented by a single byte, so that the length of any particular record is not dependent on the coincidence of characters in that record.

8-bit bytes are reasonably economical of storage space

For purely numerical work, a decimal digit can be represented by only 4 bits, and two such 4-bit bytes can be packed in an 8-bit byte. Although such packing of numerical data is not essential, it is a common practice in order to increase speed and storage efficiency. Strictly speaking, 4-bit bytes belong to a different code, but the simplicity of the 4-and-8-bit scheme, as compared with a combination 4-and-6-bit scheme, for example, leads to simpler machine design and cleaner addressing logic.

Byte sizes of 4 and 8 bits, being powers of 2, permit the computer designer to take advantage of powerful features of binary addressing and indexing to the bit level (see Chaps. 4 and 5 ) .

Overall this makes me feel like an 8-bit byte is a pretty natural choice if you’re designing a binary computer in an English-speaking country.


A few years ago I was working for a company making a mass-produced micro-controlled product. The micro chosen was a 4-bit device, with complex bank-switching to access memory and control bits, but it still needed to do a lot of accurate maths. It was a real pain to program. 8-bit devices were much simpler to program, so I asked why they were using a 4-bit. The answer, predictably, was cost. The 4-bit chip was pennies to buy in bulk, the 8-bit about 10 times the price, but still less than a $. The extra cost of the progamming effort needed for the cheap chip was easily covered by the saving in buying the hardware.

I've never used anything other than 8-bit chips, but I have got, somewhere, a 1-bit microcontroller, the MC14500B. Read about it here : https://www.righto.com/2021/02/a-one-bit-processor-explained-reverse.html
 

erco

Senior Member
IF YOU CAN'T DO IT WITH A BYTE VARIABLE, IT DOESN'T NEED TO BE DONE.

End grumpy old curmudgeon rant. :)

JK Gramps, many hobby micros use 0-255 byte values. No conspiracy afoot.
 

Gramps

Senior Member
"A typical microcontroller is a computer-on-a-chip including RAM and ROM, with strong I/O support, providing a single-chip solution."
Whereas a microprocessor requires all the external stuff to make it work. Correct?
But then there is a micro computer.
How is it different from a microcontroller?
Probably more bells and whistles toot toot
 

inglewoodpete

Senior Member
While most hobby level and a lot of commercial products use 8-bit microcontrollers, there are many 16 and 32-bit microcontrollers around. My current project uses a PIC32, which you might guess uses 32-bit data words. But, don't fret - it communicates with a PICAXE 20X2 via a wireless link, so I think I can mention it here.

"A typical microcontroller is a computer-on-a-chip including RAM and ROM, with strong I/O support, providing a single-chip solution."
Whereas a microprocessor requires all the external stuff to make it work. Correct?
But then there is a micro computer.
How is it different from a microcontroller?
Probably more bells and whistles toot toot
Correct, a mictrocontroller can have it peripherals like RAM, Flash, EEPROM, PWM, various communication parts on the one chip, making accomodating the wiring much, much simpler. Microprocessors are becoming a bit dated because they need their peripherals is discrete chips. A microcomputer generally has the whole device on one circuit board - power regulators, LEDs, driver chips and other components and, of course a miriad of connectors for things like keyboard, mouse, display and internet connection. Bells and whistles? - Now that is old technology!
 
Last edited:

AllyCat

Senior Member
Hi,
But then there is a micro computer.
How is it different from a microcontroller?
It's not a Black and White situation, there will be lots of Grey in between. But I would define a Micro Controller as being "small" with all the major functions including memory on a single chip and NOT particularly intended for "Number Crunching". The PIC(axe) is a good example, as its name was derived from "Peripheral Interface Controller".

At the other extreme I would descibe a Micro Computer as being "Larger" with (mainly) external Memory and intended more for Heavy Mathematical operations. Examples would be the Pentium or now i7 computer chips, which used to be called "Complex Instruction Set Computers" (CISC).

Then there are the ARM (Acorn RISC Machines) processors where the RISC stands for "Reduced Instruction Set Computer", that are more likely to be fitted onto a small number of chips, for example in Mobile (Cell) phones. Perhaps they would be an example for a Micro Processor.

8-bit Bytes probably gained early acceptance because they were a good compromise between lower-cost 4-bit "calculators" and early 16-bit "computers" such as the Z80, which was basically an 8-bit processor, but with "extended" instuctions and registers for 16-bit calculations (a little like PICaxe Basic). Interestingly, 10 and 12 bit "bytes" don't seem to have been considered even though they were "established" computational sizes, 10 for obvious reasons (number of fingers) and 12 because it has convenient divisors (hours in a day and a base of UK currency at the time, etc.). Perhaps they weren't considered because their limitations as a counting system were already known. ;)

But even more surprisingly, the PICs which we know (and love?) use a 14-bit Instruction Word! To be honest, I think that was a "Bad" choice because, having written Assembler Programs for PICs, Z80 and 8051 (another 8 - 16 bit architecture), etc., the PIC seemed a much less "convenient" architecture than the others, with their mainly 16-bit instruction lengths (e.g. 8-bit OpCode + 8-bit "Data" field). But the "Strength" of the PICs was the quantity of useful Hardware that they managed to fit onto their chips (e.g. EEPROM, Timers, ADC, PWM, etc.), and this was 25+ years ago.

And of course, the "Turing Machine" was effectively a 1-bit wide computer architecture than could use any Byte/Word width of OpCode and Data :
"A Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer algorithm."

Cheers, Alan.
 
Top