• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

What does uint8 do?

Status
Not open for further replies.

camerart

Active Member
Hi,
I am wading though part of a program, which is 'helping' me convert and write an Oshonsoft program.
There is a part:
uint8 addr =
What does uin8 do please? How do I convert it to Oshonsoft?
Camerart.




Camerart
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
hi C.
Clip:
Unsigned Integers of 8 bits. A uint8 data type contains all whole numbers from 0 to 255. As with all unsigned numbers, the values must be non-negative. Uint8's are mostly used in graphics (colors are always non-negative).

Use Byte.
E
 

camerart

Active Member
hi C.
Clip:
Unsigned Integers of 8 bits. A uint8 data type contains all whole numbers from 0 to 255. As with all unsigned numbers, the values must be non-negative. Uint8's are mostly used in graphics (colors are always non-negative).

Use Byte.
E
Morning Eric,
How do I actually write 'uint8 addr in Oshonsoft?
C.
 

ericgibbs

Well-Known Member
Most Helpful Member
Morning C,
One method is:
Dim addr as Byte


E
 
Last edited:

camerart

Active Member
Morning C,
One method is:
Dim addr as Byte
addr =

E
Hi Eric,
Ok, I'll try that. thanks.

I can't help wondering why this wasn't used in the sheet I'm copying? unless it's something to do with the RD/WR SPI needing OR 0x80?
C.
 
Last edited:

camerart

Active Member
Hi again,
The first question was regarding:
uint8 addr =


I'm now at a line:
int addr =

What's the difference?
C.
 
Last edited:

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
You also need to realise that uint8 is some shorthand written by programers to enable themselves to be lazy.

unsigned char = uint8... as Eric said 8 denotes the bits...

int is a word in Oshonsoft.... But!! int could be unsigned or signed so Oshonsoft may clip it... Clip it???? I hear you say..

Take the size 0 ~ 65535 this is a 16 bit integer..... -32768 ~ +32767 is a signed 16 bit integer... Normally unsigned is assumed in the programming world, but for a few numpties ( who will probably whinge here ) it isn't!!

So UINT8 is 8 bit unsigned and INT is 16 bit unsigned "signed means it can go negative..."
 

camerart

Active Member
Hi I n N,
Ok, so if I set them both DIM AS WORDs in case one is 16 bits, I presume that will be ok?

Here is a section of DATA sheet, showing the area involved. Quite a puzzle!
C.
 

Attachments

jjw

Member
Hi I n N,
Ok, so if I set them both DIM AS WORDs in case one is 16 bits, I presume that will be ok?

Here is a section of DATA sheet, showing the area involved. Quite a puzzle!
C.
Oshonsoft Basic uses Byte to send or receive SPI data.
Where did you find that 16bit integer was used for data?
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top