Continue to Site

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.

  • 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.

8051

Status
Not open for further replies.

mstechca

New Member
Perhaps I should add something.

It seems that all over on the internet, when I look for code for the at89c2051 (an 8051 compatible microcontroller), I see code, but I also see lines similar to the following in some code:

SETB 1.1
CLR 3.1

I downloaded the entire instruction set for my microcontroller from Amtel, and they gave me opcode equivalents for the commands, but not for the port numbers. I assume something is generic with them.

The parameter for each command is 8-bits according to the document. How do I convert the port outputs (1.1, 3.1, etc) to the correct ascii value? There is no site so far that shows me this.
 
mstechca said:
How do I convert the port outputs (1.1, 3.1, etc) to the correct ascii value? There is no site so far that shows me this.

AT89C2051 has only port 1 and port 3. Port 1 has eight pins and port 3 has only seven pins. The LSB is called bit 0 and the MSB is bit 7.

SETB and CLR are bit operations that operates on one single bit.

SETB 1.1 = Set bit 1 of port 1

CLR 3.1 = Clear/reset bit 1 of port 3
 
I already know that.

Let me redefine my question.

If I were to connect my circuit to the computer through the parallel port, what exact code must be sent from the computer to the at89c2051 to turn P1.0 on?

Please don't use SETB, because I want to know in Bits and bytes.
 
mstechca said:
what exact code must be sent from the computer to the at89c2051 to turn P1.0 on?

OK, in hex SETB = D2 and Port 1.0 has an address of &H90.

So SETB 1.1 = D2 90

But the above is already stretching my knowledge of 8051 to its limit. I'm afraid I can't offer much help to you furthur. :(
 
thanks. Now if I could figure out the rest of the ports, I should then be set.
 
mstechca said:
thanks. Now if I could figure out the rest of the ports, I should then be set.

Presumably the datasheet will explain it all?.

Why did you chose this processor?, as you appear to know nothing about it! (as I don't).
 
reply

Nigel, sometimes hobbyist get board of the same microcontroller and like to explore other options.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top