| Author |
Message |
zhi_yi
Joined: 02 Feb 2005 Posts: 197
|
22 Jul 2005 12:54 at89s52 assembler |
|
|
|
|
hi there..., please help me with AT89S52, if i send data to port 1, and the p1 is normally high (FFh), and then i send 0001b to port 1.1- port 1.4, will it become 1Fh??
what is internal pull up??
how to access register bank 1, 2 and 3 in assembler??? my friends said that we can access to bank 1, 2, or 3 with "USING" in C compiler, how about if we want to access it in assembler???
and then.. please tell me if there is a good links / ebooks / tutorials / schematic / trial and error for learn about microcontroller and then... please help me with a schenmatic for make a atmel burner
thank you very much
|
|
| Back to top |
|
 |
IanP
Joined: 05 Oct 2004 Posts: 6491 Helped: 1542 Location: West Coast
|
22 Jul 2005 13:16 at89s52 & c compiler |
|
|
|
|
Better option, while addressing a pin (bit) in oppose to addressing the whole port, is to use the following instruction:
SETB P1.4 to set it high,
or,
CLR P1.4, to set it low.
This will keep the other pins unchanged ..
If you want to select the other register banks you have to set up register bank bits RS0 and RS1.
If you are doing this in assembly, the instruction will be as follws:
CLR RS0
CLR RS1
for register bank 0-7
for register bank 8-15:
SETB RS0
CLR RS1
In C you can use the asm command:
#asem
CLR RS0
CLR RS1
#endasem
to select the register bank 00 .. and so on ..
For a programmer try this limk:
http://chaokhun.kmitl.ac.th/~kswichit/shiao/prog.htm
Regards,
IanP
|
|
| Back to top |
|
 |
zhi_yi
Joined: 02 Feb 2005 Posts: 197
|
24 Jul 2005 4:03 asembler pro at89s52 |
|
|
|
|
"If you want to select the other register banks you have to set up register bank bits RS0 and RS1.
If you are doing this in assembly, the instruction will be as follws:
CLR RS0
CLR RS1
for register bank 0-7
for register bank 8-15:
SETB RS0
CLR RS1 "<-- quote
oo.. so, if i want to select bank 2 (R16-R23) so the instruction will be like this ?
CLR RS0
SETB RS1
and then for bank 3 the instruction should be like this
SETB RS0
SETB RS1
is it right?
thank you very much
and then.. how to use the 32 bidirectional i/o port as input? is it we just need to send data through the port, so the port will functioned as input port?
and then.. what is the meaning of internal pull up??
thank you very much
|
|
| Back to top |
|
 |
Google AdSense

|
24 Jul 2005 4:03 Ads |
|
|
|
|
|
|
| Back to top |
|
 |
IanP
Joined: 05 Oct 2004 Posts: 6491 Helped: 1542 Location: West Coast
|
24 Jul 2005 7:58 c compiler for at89s52 |
|
|
|
|
With RS0 and RS1 you've got it correct.
If you set all pins to high (you can use instruction such as MOV P1, #0FFh, MOV P2, #0FFh and so on .. After reset you have that situation as a default ..
To read inputs use the same instruction MOV: for example, MOV A, P1 will leave the A register with the value present at that moment at P1 ..
Microcontroller have buil-in components (n-mos, p-mos or both) which act in the same way as if you had an external resistor connected between a pin and Vcc. If a pin is set to logic H the internal pull-up is active and sets the voltage level close to Vcc, but this pull-up is also called "weak pull-up" and it can be easily sink to 0V (logic L) by a TTL/CMOS output of another IC ..
Regards,
IanP
|
|
| Back to top |
|
 |