Discussion forum for the BasicX family of microcontroller chips.
|
Hi, Well i kind of solve my previous question but i am having a new one: What is the difference between a serial and a non-serial LCD?Can the second one work with BX24? Thank you, Regards naimead |
|
|
|
--- In , "naimead" <naimead@y...> wrote: > What is the difference between a serial and a non-serial LCD? > Can the second one work with BX24? If the LCD does not have a serial interface, it is likely to be a parallel interface. Some of the LCDs that I've seen support both a 4- bit and an 8-bit parallel interface. When using the 4-bit interface method, you still send it 8-bit commands and data but you do it in 4- bit chunks. In addition to the 4 (or 8) data lines, the displays that I've seen also require an enable signal, a register select signal and a read/write signal. Counting the common ground, that means that you would need either 7 or 11 I/O lines to communicate with a parallel display. If you have other external devices that need similar signals, you may be able to share several I/O lines between multiple devices. Of course, you can add external circuitry between the BX-24 and the parallel display to reduce the number of BX-24 I/O lines needed. Typically, this would comprise a pair of shift registers for serial- to-parallel and parallel-to-serial conversion. You'd use ShiftOut() and ShiftIn(), respectively, to send data to and retrieve data from the shift registers. In many cases, it is not necessary to read data from the LCD so you can omit the parallel-to-serial conversion. I have a web page describing a controller that I built for a diesel generator which included a parallel LCD and few other parallel devices. The controller was built using a BasicStamp but the ideas are exactly the same. See this link for schematics and code: http://www.kinzers.com/don/GenSet The answer to the question of "can X be used with the BX-24" is usually "yes". It's simply a matter of how much and what kind of software and/or hardware will be required. Even with devices that are simply too fast to be serviced directly by the BX-24 can often be interfaced to the BX-24 by adding external circuitry or processing power. |
|
|
|
Well i am officialy impressed.Great job!To be honest i though something like that for an external circuit: http://www.allegromicro.com/sf/5841/index.asp I am using the L1682 LCD module. Have you got something to propose instead of the above link? |
|
|
|
--- In , "naimead" <naimead@y...> wrote: > [...] > http://www.allegromicro.com/sf/5841/index.asp > Have you got something to propose instead of the above link? I would favor the 74LS595 just because I've used them before and they are commonly available. This device has tri-state outputs so it can be used in a situation where you need to both read from and write to a device. If you only need to write, the 74LS164 would likely be a better choice because it is quite a bit less expensive. Another option is the 74LS594. For parallel-to-serial conversion, I'd use the 74LS166. All of the devices mentioned above also come in CMOS versions. Just replace the 'LS' with 'HCT', e.g. 74HCT595. You may be able to use the 'HC' versions as well as long as you observe the usual precautions. |
|
|
|
Hi, I am designing a robot car whose design consists of the following main components 1) bumper switches that are normally open but close upon hitting an object. 2) a 74LSO4(inverter) that acts as a buffer between the input from the bumper to the BX-24. 3) a couple of relays that drive two motors forward and which are hooked up to the BX24 via the inverter so as to nullify any spikes due to kickback from the relay. now my design seems to be working except that at times when I provide power to the microcontroller i hear a wierd clicking noise which persists. I think its something to do with the relays drawing a large current but I am not quite sure. Would any of you happen to know how to solve the problem ....perhaps a decoupling capacitance and if so across vdd and gnd of the inverter ? Thanks, |
|
|
|
Do you have diodes accross the relay primaries? They have reverse EMF just like the motors. You may need back biased diodes around the motors as well. If you are reversing the polarity of the power going to the motors with the relays, you may want to put the protection diodes on the primary power input side of the relay contacts. In general, I suggest the "divide and concor" method. Get the system working with just the relays, motors disconnected. Work out the bugs, then connect the motors. If you still have problems with motors but not without then supply bypassing and grounding need to be looked at. I found I had to provide two power and ground leads going back to the battery terminals to get the best isolation. (Not to mention decoupling.) What is powering the inverter. Because the inverter is powering the relay, it may need to be a seperate supply. Just a couple of suggestions. Kirk --- Anand Ramaswamy <> wrote: > Hi, > I am designing a robot car whose design consists of > the following main components > 1) bumper switches that are normally open but close > upon hitting an object. > 2) a 74LSO4(inverter) that acts as a buffer between > the input from the bumper to the BX-24. > 3) a couple of relays that drive two motors forward > and which are hooked up to the BX24 via the inverter > so as to nullify any spikes due to kickback from the > relay. > > now my design seems to be working except that at times > when I provide power to the microcontroller i hear a > wierd clicking noise which persists. I think its > something to do with the relays drawing a large > current but I am not quite sure. > > Would any of you happen to know how to solve the > problem ....perhaps a decoupling capacitance and if so > across vdd and gnd of the inverter ? > Thanks, __________________________________ |
|
well i managed to obtain the SN74LS164N but could you possible tell me how can i use that with my parallel LCD?I really don't know what to do since i haven't used that before! |
|
|
|
--- In , "naimead" <naimead@y...> wrote: > i managed to obtain the SN74LS164N but could you possible tell > me how can i use that with my parallel LCD?I really don't know what > to do since i haven't used that before! There is an article on using a '164 shift register at the BasicX Documentation Project: http://www.bxdocs.com/index.asp?pi=article:HCT164_01&hp= The '164 is an 8-bit serial in, parallel out shift register. You can use ShiftOut() to send 1 to 8 data bits to the shift register and the outputs will remain in their respective states until you issue another ShiftOut() command. You would use these outputs to present data to the LCD. Tie pin 1 and pin 9 together and connect them to a pullup resistor connected to +5V. Connect pin 8 (clock) and pin 2 (data in) to separate BX-24 pins. Those pins are the ones that you'll specify in the ShiftOut() call. Note that you'll have to set these pins to be outputs initially. You'll also need to drive the RS (register select) and E (enable) pins of the LCD. These can be connected to two additional BX-24 outputs. You can probably hard wire the R/W pin of the LCD to the write state but check the timing diagrams of the device to be certain. In your initialization code (executed once) you'll want to make the 4 pins mentioned above outputs. You'll probably want to set the output driving the clock pin of the shift register low initially. The pin driving the Enable line of the LCD will probably need to be low as well, assuming that it is active high. The initial state of the pins driving the data input to the shift register and the LCD's register select line is not important; they just need to be outputs. To write a command or data to the LCD you'll have to do the following: 1) Call ShiftOut() to place the 8-bit command or data value into the '164 shift register. 2) Set the output driving the LCD's Register Select line for either command or data as appropriate. 3) Pulse the output driving the LCD's Enable line for at least the minimum duration required by the LCD. The PulseOut() procedure is useful for this or you could do it manually by using PutPin(). You'll need to be careful to not send data too fast to the LCD. The spec sheet may indicate how long you must wait. The LCDs that I've seen have a bit in their status register that indicates if the LCD is ready to accept commands or data. This is why it might be useful to be able to read from the LCD. If you want to do this, you won't be able to use the '164 since it will always be driving the LCDs data lines. You can either get a 74LS244, which is a tri-state buffer, and put it between the '164 and the LCD or use a '595 shift register which has the tri-state buffer built in. If you go this route, you'll have to dedicate another I/O pin to drive the LCD's R/W line. You'll have to add a step to the procedure above as well to set the state of the line to effect a write. The read process is similar but you set the control lines first, set the enable high, latch the LCD's output, set the enable back low and the shift in the data from the latch. If you don't have information on your LCD's command set, the link below may be useful. It gives the command set for HD44780 compatible devices (which many LCDs are). http://home.iae.nl/users/pouweha/lcd/lcd.shtml Don |
|
|
|
This is the code the guy wrote: ------------------------------------------------------------------- Option Explicit Private Const pinData As Byte = 5 Private Const pinClock As Byte = 6 Public Sub Main() 'This should alternate every other LED 'with a one second pause between Do Call ShiftOutByte(&HAA) 'bx10101010 Debug.Print "Flipping" Call Sleep(500) Call ShiftOutByte(&H55) 'bx01010101 Debug.Print "FlippingAgain" Call Sleep(500) Loop End Sub Public Sub ShiftOutByte(ByVal inByte As Byte) 'Pull clock low Call PutPin(pinClock, bxOutputLow) 'Send the data 'The BX ShiftOut sends MSb first and Sloan pointed out 'that Q0 normally equates to the LSb. Call ShiftOut(pinData, pinClock, 8, inByte) End Sub ----------------------------------------------------------- Can i possibly connect it with the code in the following example? http://www.totalrobots.com/examples/example27.htm |