Mar 29th, 2024, 2:14am
Welcome, Guest. Please Login or Register.
Pages: 1  Reply Reply  Notify of replies Notify of replies  Print Print
   Author  Topic: Want to control a circuit using simple code  (Read 3127 times)
Gonda
FabulaTech Forum Newbie
*



View Profile         
Posts: 1
Want to control a circuit using simple code
« on: Mar 14th, 2018, 6:21am »
Quote Quote  Modify Modify

I created a circuit like the following:
http://www.kynix.com/BlogImage/Circuit.png
 
I have sub-circuits that all take serial data as input and do miscellaneous processing with it. Most of the sub-circuits are just light displays. I want to control such circuits with one microcontroller with simple code.
 
For simplicity, lets assume all these sub-circuits have no option for a data reset and that the only inputs allowed to them are clock and data into 74HC164's(datasheet: http://www.kynix.com/uploadfiles/pdf8798/74HC164AN.pdf) of each sub-circuit. I have illustrated that on the right-hand side of the shown circuit.
 
Due to PCB wiring and such, I ended up connecting pins 4 and 5 of the 74HC138 decoder to the TXD line which (according to several resources can function as a clock in serial mode 0). I connected pin 6 to a GPIO pin in an attempt to prevent false alarms.
 
What I want to do in software is to easily select any one device and send data to it preferably with the fewest instruction cycles as possible.
 
Because serial port mode 0 for 8051 is a good candidate, I thought about it by using code like this:
 
mov P1,#8Fh ;use 1st device
clr TI
mov SBUF,A ;A=8 bits of data
jnb TI,$ ;wait for full transmission
mov P1,#9Fh ;use 2nd device
clr TI
mov SBUF,A ;A=8 bits of data
jnb TI,$ ;wait for full transmission
clr TI
mov SBUF,A ;A=8 bits of data
jnb TI,$ ;wait for full transmission - here we sent 16 bytes to device 2.

 
That's the kind of code I ultimately like to use, but I feel theres a slight problem because if I'm not mistaken, one document online claimed the TXD line goes from low to high when it signals data is ready. and it makes me think TXD will stay low if no data is transmitted. If that document is correct, then if I choose to switch devices then the last device used will have a low to high transition (meaning an extra unwanted bit is to be processed).
 
My only other options are to explore other serial modes and if that wont work, I may have to bit bang or redo the entire hardware (which is an option I will not take).
 
Anyone have any solid solution to this?
IP Logged
Sergey_Jarovski
FabulaTech Forum Moderator
FabulaTech Forum God
*****



View Profile   WWW         
Gender: male Posts: 556
Re: Want to control a circuit using simple code
« Reply #1 on: Mar 14th, 2018, 8:54am »
Quote Quote  Modify Modify

Hi,
 
Our software can only work on Windows PCs. There is no way to use it in the controller.
 
If you are enough that our software will set logical levels of signals (1 - 0) on the pins of the DB9 connector on the computer - then use it.
We do not control the voltage at the DB9 connector at all - it can differ for DB9 on the computer's motherboard, on the DB9 on the laptop and on the USBtoCOM adapter (12 or 5 or 3 volts depending on the manufacturer).
IP Logged

Sergey Jarovski

FabulaTech
===================
http://www.fabulatech.com
Pages: 1  Reply Reply  Notify of replies Notify of replies  Print Print

« Previous topic | Next topic »
Online Talk to our
support team or
sales department.