Forums

8051 connect LED, Button, and SPI

Started by suds February 17, 2008
Hi,

MCU,used 89C51


I am doing a project which involves, interfacing SPI or Microwire 3-wire
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, and
pres button switch. Also need any sample c programs( I am only familiar
with C)

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

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


-suds



suds wrote:
> Hi, > > MCU,used 89C51 > > > I am doing a project which involves, interfacing SPI or Microwire 3-wire > 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, and > pres button switch. Also need any sample c programs( I am only familiar > with C) > > 1. When Button is pressed LED should switch on, when Button is pressed > again, LED should switch off. (Info about which port need to be used for > connecting LED and switch) > > 2. Reference to SPI c programs, Send commands to DAC. Which port to be > 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
On Sun, 17 Feb 2008 08:10:21 -0600, in comp.arch.embedded "suds"
<sudheermt@hotmail.com> wrote:

>Hi, > >MCU,used 89C51 > > >I am doing a project which involves, interfacing SPI or Microwire 3-wire >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, and >pres button switch. Also need any sample c programs( I am only familiar >with C) > >1. When Button is pressed LED should switch on, when Button is pressed >again, LED should switch off. (Info about which port need to be used for >connecting LED and switch) > >2. Reference to SPI c programs, Send commands to DAC. Which port to be >used for CLK, LD, WRITE and DATA. > > >-suds >
http://8052.com/faq.phtml is a good starting place. Port 3 can have Alternatve functions, which may influence your descions martin
On Feb 17, 9:17 pm, Martin Griffith <mart_in_med...@yah00.es> wrote:
> On Sun, 17 Feb 2008 08:10:21 -0600, in comp.arch.embedded "suds" > > > > <sudhee...@hotmail.com> wrote: > >Hi, > > >MCU,used 89C51 > > >I am doing a project which involves, interfacingSPIor Microwire 3-wire > >bus (DAC receiving data inSPI/Microwire), press button, and LED/Relay. > > >I dont know which ports need to be used forSPIData, connecting LED, and > >pres button switch. Also need any sample c programs( I am only familiar > >with C) > > >1. When Button is pressed LED should switch on, when Button is pressed > >again, LED should switch off. (Info about which port need to be used for > >connecting LED and switch) > > >2. Reference toSPIc programs, Send commands to DAC. Which port to be > >used for CLK, LD, WRITE and DATA. > > >-suds > > http://8052.com/faq.phtmlis 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
On Wed, 20 Feb 2008 23:44:07 -0800 (PST), in comp.arch.embedded
sudhirmt@gmail.com wrote:

>On Feb 17, 9:17 pm, Martin Griffith <mart_in_med...@yah00.es> wrote: >> On Sun, 17 Feb 2008 08:10:21 -0600, in comp.arch.embedded "suds" >> >> >> >> <sudhee...@hotmail.com> wrote: >> >Hi, >> >> >MCU,used 89C51 >> >> >I am doing a project which involves, interfacingSPIor Microwire 3-wire >> >bus (DAC receiving data inSPI/Microwire), press button, and LED/Relay. >> >> >I dont know which ports need to be used forSPIData, connecting LED, and >> >pres button switch. Also need any sample c programs( I am only familiar >> >with C) >> >> >1. When Button is pressed LED should switch on, when Button is pressed >> >again, LED should switch off. (Info about which port need to be used for >> >connecting LED and switch) >> >> >2. Reference toSPIc programs, Send commands to DAC. Which port to be >> >used for CLK, LD, WRITE and DATA. >> >> >-suds >> >> http://8052.com/faq.phtmlis 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