8051 connect LED, Button, and SPI

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

Reply to
suds
Loading thread data ...

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
 Click to see the full signature
Reply to
Tauno Voipio

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

martin

Reply to
Martin Griffith

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

Reply to
sudhirmt

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

martin

Reply to
Martin Griffith

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.