Control LPT port under windows XP using Delphi

Another way of controlling LPT port under Windows 2000 and XP using Delphi language. In this case library inpout32.dll is used which allows controlling LPT port registers. Ready project for Borland Delphi 7.0 you can download here: Project Files<187.5kB> And now how to do this from beginning. Start Borland Delphi 7.0 and make simple form where you can enter Data to be sent to port, Port Address, buttons for writing to and reading from port.   If you are familiar with building forms this should be ease task. OK now lets start programming. First of all wee need somehow to include inpout32.dll in to the project. For this Delphi has several ways, but lets stay to the easiest one when library is in same directory, where project is. Then in header in section uses we have to place function prototypes Out32 and Inp32 with special compiler directive external, saying where to find this finction. uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; function Inp32(PortAdr: word): byte; stdcall; external ‘inpout32.dll’; function Out32(PortAdr: word; Data: byte): byte; stdcall; external ‘inpout32.dll’;   Then lets go to the button methods. For this double click on button in form and you will…

Continue reading

Controlling external devices using COM port communications programmed using VB language

There are a lot of Radio amateurs that want to control external devices using computer standard ports. One of them is COM poert. Everybody wants things to be ease as people doing electronics are more hardware people not software. COM port is more often used than LPT because COM port is more resistive to bigger loads and there is less chances of failing. So if you know Visual Basic a little bit then this shouldn’t be very hard to use MSComm Control component which is located in Project->Components. You should check check box MSComm Control. Later you have to add this control to form and write some code for it. Main difficulty with this is that you have to follow RS232 protocol. This is why it is better to use microcontrollers that have built in USART interface. Of course MSComm component allows to read and control single COM pins and this way to control any external devices without using RS232 protocol. One good example is popular programming software PonyProg (which is programmed in other language than VB, but principals are same). You can see various supported circuits that PonyProg supports and you can see that Rx(2) and Tx(3) signals aren’t…

Continue reading

Understanding and conversion different firmware file formats

Without getting to deep int discussions why there are several firmware formats and extensions used. But fact is that you can face firmware files with extensions like BIN, HEX ir E2P. Lets see how these files look like and how to convert between them. First of all it is important to mention that all firmware files can be one of two types: Text – files contain ASCII symbols (codes from 32h to FFh); Binary – files contain all ASCII symbols including non printable symbols (00h to FFh). First advice – never rely on file extension as it can be any. All is inside file. So how to define whats inside file and what format? One easy way is to open file with notepad and see how contents look inside. Text firmware files HEX files were described earlier (Hex File Format). I can just remind that it is most universal firmware file format that most programming software understand. Each line begins with colon, then goes address:   TXT files especially loved in Korea for saving dump files. This is almost HEX file but without address pointers. Simply data in hex format without any controlled sums and so on:   Binary firmware…

Continue reading

1-Wire protocol simple and easy

1-Wire communication protocol was developed by Dallas Semiconductor owned by Maxim. This protocol allows communication of multiple chips to one host with minimal pin count. The protocol is called 1-Wire because it uses 1 wire to transfer data. 1-Wire architecture uses pull up resistor to pull voltage of data line at master side. 1-Wire protocol uses CMOS/TTL logic and operates at supply voltage range 2.8 to 6V. Master and slave can be receivers and transmitters, but only one direction at a time. LSB goes first always. Data in 1-wire network is is transferred by time slots. For instance to write logic “1”, master pulls the bus low for 15us or less. To write logic “0” master pulls buss low for at least 60us. System clock is not required as each part is self clocked and synchronized by faling edge of master.   Before communicating master resets network by holding the bus low for at least 480us and then looking for responding pulse from slaves. Then master calls slave by its address which is unique for each slave device. Each device has 48 bit (six bytes) globally unique address where last eight bits are CRC of first 56 bits. First byte…

Continue reading

How to make 5V from 1.5V

Originally by Anisimov Ivan In many cases can be very handy to be able to convert 1.5V to 5V. Then you can power microcontroller or LED from a single AA or AAA battery. It is simple to do this as there are special IC’s as MAXIM MAX1674 or MAX7176. This is step-up DC-DC converter that can convert voltages from 0.7V to any in range from 2V to 5.5V. MAX1676 have already preset pins for 3.3V and 5V, that makes easer integration in 3.3 and 5V circuits. IC can dissipate up to 444mW. Bellow is a circuit that converts 1.5V to 5V.   Lets say wee need to get maximum output current 300mA, then wee need to put some efforts. Because output power is 5V·0.3A=1.5W. Lets say efficiency is 100% then the power drawn from battery will be 1.5W too. At 1.5V voltage this will be 1A current. Not all batteries can drive such currents. Other important part is inductor. For this wee need inductor with high current saturation which usually leads to increase of size. If current is over 300mA, then inductor inductance 47uH; If current is over 120mA, then inductor inductance 22uH; If current is over 70mA, then inductor…

Continue reading

Ultrasound transducers for measuring distance

Ultrasounds transducers for measuring distances are commonly used in robotics, automotive parking sonars. Ultrasound distance measuring is non -contact measuring method – radiation and reception of ultrasound waves. Ultrasound waves are mechanical acoustic waves with frequencies more than 20kHz. Normally human cannot hear frequencies above 20kHz while some animals can. For instance bats use ultrasound location of objects. Dolphins communicate with each other using ultrasound signals. Ultrasound interacts with hard body and part of incoming wave energy is reflected back, in other words – it is back scattered. So direct wave towards object is back scattered widely – up to 180°. If object is moving – received frequency differs because of Doppler effect. Lets say simple example – parking sonar. Distance to object can be calculated very simply by formula: L=v·t·cos(α)/2 Where t- time period between transmitted and received signals; v – ultrasound speed; α – signal angle to object. If signal is perpendicular to object then cos(α)=1.   Each Ultrasound transducer has its impedance characteristics. Usually operation frequency is at lowest impedance point where sensitivity is highest:   Typical transducer operates at 32kHz. If working mode is continuous then two transducers are needed: one for transmission and second for…

Continue reading

Avoid noises in mixed signal design

Today most of all embedded systems consist of two part circuitry – digital and analog. Digital part is usually controller, its timing circuit and other input output devices. Frequently there is an analog part on same board like ADC, OP amplifiers, sensors and other analog circuitry. Such designs are called mixed-signal designs. Where digital and analog part meats – the grounding problems starts. Fact is that each conductor has its own impedance, so any current flowing result in voltage drops. Ground wires and planes isn’t exceptions. Digital and analog grounds can generate significant electromagnetic radiation that adds noises to signals we need. So the over all system quality drops because o poor design.   In a good design analog ground palane and digital ground plane should be separated. With multilayer PCB this can be done very easy. Another issue is that digital signal traces shouldn’t cross analog ground and analog signal wires shouldn’t cross digital ground plane area. Well of course and try to avoid aligning digital and analog wires as they can catch each other radiated noise. How to deal with these problems. Well first thing is to recognize problematic areas correctly. Then you will be able to implement…

Continue reading