8051 Mode 0
nsafadi said:
i think it's clear what i want .. i need to program my AT89C51 to used it as shoft register ..
like take input from port a and output the serially data from the RS232 in MU
can u help me ?
ok, so you want to read portA, and send the data to a shift register, correct?
if this is correct, you can set up the 8051 in shift register mode.
code would be something like this:
Code:
;set up 8051 in mode 0 (shift register mode)
;RX pin = DATA you want to send
;TX pin = CLK
;I assume you are using a 74HC164 shift register
mov scon,#00h ;set mode 0 and clear all interrupt bits
;get the data from port a, copy to acc here first
send:
mov sbuf,a ;copy data you want to send from acc to sbuf
jnb scon.1,$ ;wait until transmission complete
ret
I hope this helps you or gives you some insight.
nsafadi said:
and i need some toturial for AT89C51
The Book called:
The 8051 Microcontroller Architecture, Programming, and Applications
by Kenneth Ayala
Perfectly describes exactly what you are doing with a schematic and all the code!
The book proved to be very useful to me when I was first learning 8051.
There are many code/schematic examples from everything to DAC, ADC, keypad, LCD, and many more.
Do a google search, I think there is a scanned copy in PDF format somewhere on the net that you can download.