8051 connect LED, Button, and SPI

Feb 17, 2008 4 Replies

Hi,



MCU,used 89C51


I am doing a project which involves, interfacing SPI or Microwire 3-wir bus (DAC receiving data in SPI/Microwire), press button, and LED/Relay.



I dont know which ports need to be used for SPI Data, connecting LED, an pres button switch. Also need any sample c programs( I am only familia with C)


  1. When Button is pressed LED should switch on, when Button is presse again, LED should switch off. (Info about which port need to be used fo connecting LED and switch)


  1. Reference to SPI c programs, Send commands to DAC. Which port to b used for CLK, LD, WRITE and DATA.


-suds


Time to leave in the study project?

-

There are many different SPI A/D converters, you cannot get a good answer with that question.

Tauno Voipio tauno voipio (at) iki fi

formatting link
is a good starting place. Port 3 can have Alternatve functions, which may influence your descions

martin

Thanks Everybody !

in simple lang, can I use Port 1 for SPI, sending Data/ command to a DAC ?

I have seen some circuits, where they used combination of port 1 and port3, so got confused.

-suds

Correct, look up "bit twiddling". If you use Port0 as inputs you will probably need resistive pullups to Vcc

martin

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required