Serial To Parallel Converter I2c Controller

Serial To Parallel Converter I2c Controller

Yamaha motif xs sounds

Digital parallel and serial converters adapt data transmitted in a parallel port to a serial communication format, or adapt serial port data to parallel communication format.

It will then convert the serial data back into parallel data for the. Clock synchronization is performed by connecting the I2C interface to the SCL. What is needed to run the the simulator? Read to get most recent information! Tips for using the simulator. The simulator: pidserialparallel.exe.The simulator runs immediately after the download by clicking Open in the download window. Alternatively, you can first save a copy of the exe-file on any directory (folder) on your PC and then run the exe-file, which starts the simulator.

Data converters are needed because not all devices in a system work entirely as parallel-only or serial-only components. For instance, the communication inside a computer uses parallel buses that transmit parallel data from component to component. However communication among external devices take place using serial data. A network of computer receives data from the internet using serial communication. When the data arrives at a particular network node, the communication switches to parallel data transmission.

Converters are designed using D flip-flops (D latches work as well). A D flip-flop transfers one bit from its input to its output every time the clock shifts from low to high (if the device is a positive-edge triggered flip-flop), or from high to low (if the device is a negative-edge triggered flip-flop.) If, for instance, there is high (logic 1) at the input D of the flip-flop, then when the clock edge goes from low to high the logic 1 in the input is transferred to the output terminal, the Q pin. This situation is depicted in the figure at right.

If another D flip-flop is connected to the output terminal of the first, then we can transfer two bits of data with two ticks of the clock. The following figures depict this situation. The bits 0 and 1 are at the input of the first flip-flop. At the first tick of the clock the first bit is transferred to the output of the first flip-flop, which becomes the input of the second. Now there is one bit (0) at the input of the first and a bit (1) at the input of the second flip-flop. At the second tick of the clock there is a transfer that puts one bit (0) at the input of the second flip-flop and a bit (1) at its output. This process is repeated if there are more flip-flops connected in series. In general, transferring n bits requires n flip-flops.

I2c to rs232 converter

Transmissions

There are the two basic types of transmission modes available in digital systems, serial and parallel transmission.

Parallel Transmission

Parallel transmission uses one communication line for each bit of the message. For example, to send a message of eight bits, eight wires are required from transmitter to receiver. The ensemble of the eight wires is called a data bus. Parallel transmission is normally used when the physical distance between the transmitter and the receiver is short, because is difficult to maintain bit synchronization in long transmission. Typically parallel transmission is preferred within a device; communication pathways between the CPU and memory of a computer are parallel. There are several protocols used in parallel data transmission throughout the industry, including parallel PCI, ISA, ATA, and SCSI. The accompanying figure depicts the transmission for an eight-bit message using a parallel bus.

Serial Transmission

Each bit of the message is sent to the receiver one bit at a time using one communication line. Most communication is carried out using serial data. Serial communication requires less wires and less complex electronics, but to compare parallel data it must transmit at a faster rate. Examples of serial data protocols include Internet, USB, SPI, I2C , Firewire and others.

Conversions

Serial to Parallel Conversion

To convert serial data to parallel data a set of D flip-flops is needed. The number of flip-flops is exactly the size of the serial data to be transmitted. For example, to transmit four-bit serial stream four flip-flops a required. A schematic of a four-bit converter is depicted.

The serial data is delivered at the input of the first flip-flop, and bits are successfully transferred to the next flip-flop on the rising (or falling) edge of the clock. The next figure shows an actual circuit for a four-bit converter, where four bits (0, 0, 0, and 1) are stored at the input of the first flip-flop.

With the first rising edge (i.e. tick) of the clock, the first bit (1 in this case) is transferred to the input of the second flip-flop. Successive ticks moves the bits to the next flip-flop, until all four bits are stored at the output of each flip-flop. In this figure we have not shown all the circuitry of an actual converter. The converter does not release the parallel set of bits until all the bits (four in this case) are transferred, and each one is stored at the output (Q) of a corresponding flip-flop. Once all the outputs are filled, the converter releases all the bits at once. For this process to happen, the converter is disabled (by means of one or more control lines) during the transfer process and enabled once all the bits are at the output bus. This is summarized by stating that the conversion is carried out in three stages:

  1. Disable the output bus. The converter can't send output data.
  2. Load all the bits into the outputs of the flip-flops by moving them one bit at a time using the clock.
  3. Once all the bits are loaded (all the flip-flops have one bit stored in the Q pin), then enable the bus operation. The four bits are sent at once.

Parallel to Serial Conversion

In this converter all parallel data is loaded (stored) simultaneously into the D-type flip-flops. Once this is achieved, with the help of the clock, data is shifted one bit a a time from the last flip-flop. This two-step process is schematically illustrated in the accompanying figure.

In an actual converter, more circuitry is needed. Simply, the parallel data is multiplexed in order to convert it into serial data. The multiplexer will force the parallel data to be shifted one bit at a time through the last (most significant bit) flip-flop. The following figure is the diagram of a four bit converter. There are four flip-flops and three multiplexers. Each flip-flop is the output of a multiplexer, with the exception of the first flip-flop, which will represent the least significant bit (LSB) of the output serial data. Each multiplexer has two inputs (known as a 2 x 1 mux) and one output. The inputs are one bit of the parallel data and one input from the previous flip-flop.

Specifications

  • Clock speed. Normally given in Hz, it is the speed at which the data is shifted inside the converter
  • The size of the converter. This is the number of bits the converter can handle
  • Power. The total power needed to operate the device (current or voltage, or both)

Image credits:

Engineering360


Introduction: HD44780 LCD to I2C Adapter Board for the Bus Pirate

Cheap character LCDs based on the HD44780 chipset come in a variety of sizes: 2x16, 4x20, etc. These displays have two standard interface modes, 4bit and 8bit parallel. 8bit requires a total of 11 data lines, 4bit requires 7 (6 for write-only). Some LCDs support an additional serial data mode, like the VFD I covered at Hack a Day.
HD44780 LCDs are generally 5volt parts with a separate supply for the back light. The Bus Pirate only has five 5volt tolerant I/O pins, so we made a small adapter board with enough pins to control the LCD. The Bus Pirate controls the adapter board through its LCD interface library.
Continue reading about the Bus Pirate HD44780 character LCD adapter board and interface library.
I can have PCBs, kits, or assembled kits produced by Seeed Studio for about $15, including worldwide shipping, more here.
I couldn't include some formatting elements and HTML tables in an Instructable, you can see the original post at the Dangerous Prototypes blog.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Hardware

Overview
In this article we outline an I2C adapter board for HD44780-based LCDs. We demonstrate it with a Bus Pirate universal serial interface. The Bus Pirate source code for the I2C-based HD44780 interface library is public domain, so it's free to adapt to your own projects.
Hardware
Full size circuit image [PNG]. The circuit and PCB were designed with the free version of Cadsoft Eagle. The design files can be downloaded from the Bus Pirate SVN. Before using the adapter board, be sure to verify the datasheet for your LCD against the adapter pinout. Not all LCDs are the same.
PCF8574 I/O expander IC
This is a simple 8 I/O expander chip that's controlled through the two-wire I2C interface. The I2C interface is accessible from header JP1.
The PCF8574 works from 2.5 to 5volts. The I/O pins operate at the supply voltage, so if we feed it 5volts it interfaces the LCD at 5volts. C1 (0.1uF) decouples the IC from fluctuations in the power supply.
One pin of the PCF8574 controls a 3mm LED (LED1) through current limiting resistor R2 (1000 ohms). The LED lights to indicate successful communication between the Bus Pirate and the adapter. The PCF8574 can't source enough current to power the LED, so we power the LED from the 5volt supply and switch the ground.
LCD
The adapter board communicates with an HD44780-based character LCD in 4bit parallel interface mode. The 4bit interface pins - RS, RW, EN, and D4-D7 - are connected to seven of the PCF8574 I/O pins. We like to use 0.1' male pin header to connect the adapter to an LCD, you can usually lean the LCD against the pins to create sufficient contact for a quick test.
Trimmer resistor R1 (10K) provides a contrast adjustment voltage to pin 3 of the LCD header.
We didn't connect the backlight pins because there's so many different backlight styles. Providing power for an LED backlight might damage a screen that requires a negative voltage supply.
Power supply
Most LCDs require 5volts, provide an external power supply through header JP2. We provided a second power supply pin to connect the Bus Pirate's pull-up resistors.
PCB
The circuit and PCB were designed with the free version of Cadsoft Eagle. The design files can be downloaded from the Bus Pirate SVN. The PCB is a single-sided, all through-hole design with a single jumper wire (shown in red).
We can have PCBs, kits, or assembled kits produced by Seeed Studio for about $15, including worldwide shipping, more here.
Partlist
Part
Value (all through-hole)
C1
0.1uF/10volts+
R1
10000 (10K) ohm single turn trimmer/potentiometer, 6mm
R2
1000 (1K) ohm resistor, 1/4 watt
LED1
3mm (T1) LED, red
JP1+JP2
0.1' male header, 5 pins
IC1
PCF8574N, 8bit I2C I/O expander DIP16
ICS1
16 pin DIP socket for IC1
I couldn't include some formatting elements and HTML tables in an Instructable, you can see the original post at the Dangerous Prototypes blog.

Step 2: Connections

Device: HD44780 character LCD.
Bus: 4bit parallel, with PCF8574 I2C adapter board.
Power requirements: 5volts.
References:example datasheet [PDF], HD44780 command reference, HD44780 LCD uber-site.
Complete Bus Pirate session log for this demonstration.
We designed the adapter for the LCD library of the Bus Pirate universal serial interface, but it'll work with anything that can speak the I2C protocol. Take a look at the Bus Pirate source code for an example I2C->HD44780 implementation.
Connect the Bus Pirate to the adapter board as shown in the table. The table also shows the raw connections to the PCF8574 IC if you're following along without an adapter board.
Connect the adapter to a power supply sufficient for the LCD, generally 5volts. The I2C connection between the adapter and the Bus Pirate requires pull-up resistors between 2 and 10K. Here's more information about mixed voltage interfacing with pull-ups, and the Bus Pirate on-board pull-up resistors.
I couldn't include some formatting elements and HTML tables in an Instructable, you can see the original post at the Dangerous Prototypes blog.

Step 3: Step 1. Setup Library

Interfacing
We've covered the adapter design and how to connect it to the Bus Pirate, now it's finally time to write something to the LCD.
HiZ>m <<<set mode menu
1. HiZ
..
11. LCD
12. HWI2C
(1) >11 <<<LCD interface mode
MODE SET
LCD type:
1. HD44780 (using PCF8574 IO expander)
(1) >1 <<<currently only supports HD44780 LCDs
HD44780 LCD TESTER
REQUIRES PCF8574 I2C IO EXPANDER
LCD>W <<<big 'W' turns on the power supplies
POWER SUPPLIES ON
LCD>p <<<configure the pull-up resistors
1. Pullup off
2. Pullup on
(1) >2 <<<turn the pull-ups on
PULLUP RESISTORS ON
LCD>v <<<get voltage report
VOLTAGE MONITOR: 5V: 4.9 3.3V: 3.3 VPULLUP: 5.0 <<<check Vpu
LCD>
Press 'm' in the Bus Pirate terminal and choose the LCD library. It currently it only supports HD44780 character LCDs using the PFC8574 adapter described in the first half of this article (option 1).
Enable the power supplies (big 'W') and pull-up resistors (menu 'p'). Check the voltage monitor (menu 'v') and make sure that the pull-up voltage (Vpullup) reads around 5volts.

Step 4: Step 2. Reset and Initialization

This table outlines the single-byte commands that control an HD44780 LCD, here's a detailed reference. These commands can be entered from the Bus Pirate command line, but we've made macros for most of them to save time.
LCD>(0) <<<show macro menu
0.Macro menu <<<this menu
1.LCD Reset <<<reset the LCD
2.Init LCD <<<reset and initialize the LCD
3.Clear LCD <<<clear LCD, return cursor to 0
4.Cursor position ex:(4:0) <<<set cursor postion
5.Write test text <<<will be removed by firmware v2.1
6.Write :number test numbers ex:(6:80)
7.Write :number test characters ex:(7:80)
8.Insert text at cursor
LCD>
Macro 0 displays the macro menu for any Bus Pirate mode.
LCD>(2) <<<initialize LCD macro
Display lines:
1. 1 <<<single line display
2. Multiple <<<multiple line display
(2) >2 '
RESET <<<macro 2 includes a reset sequence
INIT <<<initialize the LCD
LCD>
The initialize LCD macro (2) configures the screen for 4bit interface mode, enables cursor display, and sets a few other helpful options. Configure the number of display lines, choose 1 for a single line display, or 2 for all other displays.
After initialization, the screen should be clear with a cursor visible in the corner. If it didn't work, check the I2C connection, pull-up resistors, and power supply, then try again.
HD44780 LCDs need to be reset with a special signal sequence before they can be initialized for 4bit or 8bit interface mode. Macro 1 creates this sequence. Macro 2 includes the reset sequence, so there's no need to use macro 1 before macro 2.

Step 5: Step 3. Write Test Characters

LCD>(6:80) <<<write 80 numbers
LCD>
The write numbers macro fills the LCD with test numbers between 0 and 9. The number after the colon tells the Bus Pirate how many test numbers to write, we're using a 4x20LCD, so we write 80 numbers to fill it. Notice that the cursor ends at position 0, under the first '0'.
LCD>(7:80) <<<write 80 characters
LCD>
The write characters macro fills the LCD with ASCII characters, enter the quantity after the colon. Notice that the fist line continues on the third, the third on the second, and the second on the last. The characters aren't continuous because character LCDs don't wrap from one line to the next. We'll talk a little more about this later.

Step 6: Step 4. Clear LCD

LCD>(3) <<<clear the LCD
CLEARED
LCD>
The clear LCD macro sends the HD44780 command that erases the screen and returns the cursor to the first position.
You could also do any of these operations without the macros, refer to the command table at the beginning of this section. Enter '[0b1' in the Bus Pirate to set the interface to command mode ([) and send the HD44780 clear screen command (0b00000001) without a macro.]

Step 7: Step 5. Type Text

LCD>(8) <<<insert user text
Enter text to insert at the cursor position.
HD44780 LCD demo <<<we typed this
LCD>
After clearing the LCD in step 4, the cursor is positioned at the first block. We could also set it with the macro (4:0), which moves the cursor to the first character.
The insert text at cursor macro asks for text input, and then copies it to the LCD when you press enter.
LCD>(4:0x40) <<<position the cursor at 0x40
LCD>(8) <<<insert text
Enter text to insert at the cursor position.
Bus Pirate v2go <<<we typed this
LCD>
Writing to the second line is a little more complicated, it actually starts at character 64 on a 4x20 LCD. If you continue writing from the end of line 1 (character 20) then you'll end up at the beginning of line three! This page has a nice collection of memory maps for most character LCD sizes.
First, we position the cursor on the second line (4:0x40). Next, the 'insert text' macro grabs our input and copies it to the LCD.
LCD>(4:0x14)(8)(4:0x54)(8) <<<multiple macro syntax
Enter text to insert at the cursor position.
Firmware v2.0+ <<<we typed this
Enter text to insert at the cursor position.
DangerousPrototypes <<<we typed this
LCD>
The Bus Pirate accepts multiple macros on the same line, so the entire screen can be written at once. We wrote to the last two lines with a single line of syntax.
We could use '(3)(4:0)(8)(4:0x40)(8)(4:0x14)(8)(4:0x54)(8)' to clear the LCD and write all four lines with a single syntax entry.

Step 8: Step 6. Reading From the LCD

The Bus Pirate and LCD adapter board can read from the LCD. We'll read the text we wrote to the screen (DDRAM), but you can also read settings and custom character ram (CGRAM) by setting the correct address.
LCD>[0b10000000 ''<<<set the read pointer'']
HD44780 RS LOW, COMMAND MODE <<<register select pin low
CMD WRITE: 0x80 <<<wrote to LCD as command
LCD>
First, we tell the Bus Pirate to send data to the LCD command register ([). Next, we use the set DDRAM address command (0b1xxxxxxx) to set the read pointer to the beginning of the DDRAM (xxxxxxx=0000000).]
LCD>]rrrrrrr <<<read data memory
HD44780 RS HIGH, DATA MODE <<<register select pin high
READ: 0x48 <<< 'H'
READ: 0x44 <<< 'D'
READ: 0x34 <<< '4'
READ: 0x34 <<< '4'
READ: 0x37 <<< '7'
READ: 0x38 <<< '8'
READ: 0x30 <<< '0'
LCD>
Finally, tell the Bus Pirate to read from data memory (]), and then read a few bytes (rrrrrrr). We got 'HD44780', the text we wrote to the screen in step 5.
You should also be able to use the shortcut r:7 to read seven bytes, but it's not working in the current firmware - we'll fix this prior to the next release.

Step 9: Doing More

Give a general description of the StepThe HD44780 character LCD adapter is a handy accessory for the Bus Pirate. It can be used for a quick test, or more advanced logic development.
In addition to LCDs, the eight 2.5volt-5volt I/O pins might be useful for other high pin-count Bus Pirate applications.
We can have PCBs, kits, or assembled kits produced by Seeed Studio for about $15, including worldwide shipping, more here.
I couldn't include some formatting elements and HTML tables in an Instructable, you can see the original post at the Dangerous Prototypes blog.

Be the First to Share

Recommendations

12 1.2K
22 3.2K
304 27K
  • Arduino Contest 2020

  • First Time Author Contest

  • Space Challenge

Serial To Parallel Converter I2c Controller
© 2020