Tuesday, December 7, 2010

Jerk Off Encouragement

A new platinum testing for PIC

This new platinum testing is a tool (fun!) Essential for anyone wishing to improve in the implementation of PIC microcontrollers. It allows you to use a keypad (as found on phones) and LCD (also digital)-now essential component the electronics lab to perform all measurements and all appropriate controls.



First a reminder: our PIC programmer, able to program the PIC microcontrollers 12F675, 16F628, 16F876 and 16F877, consists of the controller itself EN1580, EN1581 bus and food EN1203 . Added to the decks of experimentation EN1582 (the first proposed, it is part of the programmer), EN1583 (platinum four relays), EN1584 (platinum four and a triac darlington) ... and here today the latest: the keypad and display deck EN1585 LCD. The keyboard is
twelve keys and the display is an alphanumeric LCD.
We chose this time to offer you a plate of experimentation and keyboard display because it is the mode of communication most used between humans and electronic devices. Indeed, it is now common to use an LCD to display data from a measure (consider, for example measuring instruments or electrical appliances, such as ultrasonic generator, or signal converters or FM exciters or many other instruments too, offered by your journal, and you may have built).
But it is true that we think especially to devices whose use requires no professional preparation on the part of the user: the fixed and mobile phones, bank ATM, or beverage machines, as well as innumerable other private or public devices that invaded our daily lives, are equipped with keyboards and displays. It is therefore important for those wanting to train in electronics, and this is the case for our readers, even the most experienced, learning to combine microcontrollers and TSRs with these keyboards and LCD displays. This words, we can now go to the wiring diagram.


The LCD

We chose an LCD model CMC116L01 brand CTC we know well and you find in many of our fixtures, as was the case 2.2 GHz Frequency with EN1572.
This display has a value for money. Among the external components required for its operation, you have the polyester capacitor C1 inserted in the supply line (between pins 2-16 and ground) used to filter routing to ground potential disturbances (see Figure 1, the wiring diagram); trimmer R1 whose slider is connected to pin 3 to adjust the contrast of the LCD display to improve and finally R2 and R3 (15 ohms 1 / 2 W each ) connected to pin 15 and for limiting the current arriving at the bar of LED backlighting provides.
Of the eight pins on the data to send to the LCD (DB0 to DB7, Figure 2), we use only four: the other four are not connected. This configuration allows us to save four lines of I / O of the PIC.
four-bit mode is indicated by all the manuals, although many of these older neglect to mention that for this model in any case, the four remaining pins must not be connected to ground but remain unconnected.
This choice is almost mandatory when you fit a little pin PIC and we wanted to show you how to implement this solution (which, we repeat, to "win" lines I / O)

The keyboard On the deck we have also mounted a keypad matrix connected to the PIC via the connector Conna. The resistive network R4, connected between 5 V and pins A0 to A4 of the PIC16F628 microcontroller, is the resistance Drawing ("pull-up = maintenance of high logic level). If you see the table of characteristics ("datasheet") of ICP, you will see that the Port A pins have no internal pull-up resistor so it is necessary to provide an external (one per pin, where the R4 network Figure 1) and can thus use these pins as inputs "from". Note: As shown in Figure 1, a resistance network, leading to the output 2 is not used.
Jumper J1, connected between 5 V and pins 2-16 of the LCD, is normally closed (on CB). If you want to use the keyboard, you should let it open (positioned on AB) to cut power to the display.





Figure 1: Diagram of the stage of experimentation with keyboards and LCD PIC EN1585. With the trimmer R1 connected to pin 3 of the LCD, you can adjust contrast to optimize the display for easy reading. The network of resistors R4 is the resistance to pulling port pin PIC A (A0 to A4). Iist

R1 .............. 10k trimmer R2
.............. 15 1 / 2 W
R3 .............. 15 1 / 2 W
R4 .............. resistive network 6 x 1 k C1 .............. 100 nF polyester AF .............. LCD CMC116L01 CLV ............. 12-key keyboard Conna ........... 40-pin male connector CONN AF ......... connector 16 pin female conn
CLV ........ 8 pin female connector J1
.............. 3 pole jumper Miscellaneous:
2 connectors 4-pin SIMMs
six plastic spacers
Unless otherwise specified, all resistors are 1 / 4 W 5%.






Figure 2: Wiring and block diagram of the LCD CMC116L01. With the program content SIM.asm CDR1585 in staffing, it shows the complete set of characters DDRAM and CGRAM driver visible in the table.






Figure 3: To satisfy your legitimate curiosity, we opened the box the keyboard matrix (as shown in Figure 4, each button or key is connected to two pins of the keyboard).

Figure 4: Each button (key) keyboard matrix is connected to two pins.
When a key is pressed, only two pins of the keyboard are at logic low (see table cons) and, depending on the binary combination so determined, ICP detects which pins are grounded and therefore which key was pressed, he can then control the display on the LCD of the symbol.

Figure 5a: Diagram of component layout of the stage of experimentation with keyboards and LCD PIC EN1585. Only
component to properly orient: the network of resistors R4 (benchmark-keyed on the lower left to J1). Once you have soldered the jumper J1, put her jumper on CB.

Figure 5b-1: Drawing to scale 1, the circuit printed double-sided plated through holes of the plate experiment with keyboards and LCD PIC EN1585 side seams.

Figure 5b-2: Drawing to scale 1, double-sided PCB with plated through holes of the plate experiment with keyboards and LCD PIC EN1585 side components.

Figure 6: Photograph of a prototype of the plate experiment with keyboards and LCD PIC EN1585.

Notes on the LCD Figure 2 shows the pinout of the LCD CMC116L01 and description of the function of each pin. The LCD includes an integrated circuit using internal controller and driver to handle each character: the integrated circuit does virtually nothing other than read the data and commands that the PIC sends, interpret, select the symbols to be displayed and change the operating mode of the display. It has a table of internal reference (see Table characters) with which it determines, based on the binary value sent, writing a character instead of another. In this table, 248 items contiennent des caractères déjà définis constituant la DDRAM (Data Display RAM) ; 8 éléments sont en revanche personnalisables et peuvent contenir des caractères produits par l’usager. Ce sont cette fois des CGRAM (Character Generator RAM). Ces codes se trouvent dans les caractéristiques de l’afficheur LCD sous forme d’une grosse matrice : la première partie du nombre binaire est en haut et les quatre autres bits restants sont reportés sur un côté de la matrice. Comme le montre le Tableau des caractères, la lettre majuscule L, par exemple, est visualisée si nous envoyons au circuit intégré la combinaison binaire 0100 1100.
Afin d’éviter toute confusion, several manufacturers agreed to standardize the coding of alphanumeric displays.
compatible controllers have been designed: the Hitachi HD44780, the Samsung KS0066 and MSM6222 are part of OKI. Pilots HD44780 and KS0066 (the latter used in the LCD CMC116) are nearly identical and small differences between them concern only the timers control signals and data. The display has chosen a single line of 16 characters, but it should drive a display with two lines of 8 characters each (see Figure 2). If this display is observed under the microscope when illuminated, we see that each character is drawn inside a group of tiles: each of these groups is a matrix and each tile is a pixel. The pixels, consisting of a substance becomes dark crossing a stream, are arranged in a matrix of 5 x 8, which is 40 pixels per character. Of the 40, only 35 (or 5 x 7) are used to display alphanumeric characters, the remaining 5 of the last line is for the management and visualization of the cursor. Look carefully at the Table: You see that in fact each character is composed exclusively of a matrix of 5 x 7 pixels. If you send same time a number of characters exceeds six, they will be lost: so, pay attention to the length of the text, which must not exceed eight characters per sector.



Description keyboard matrix

The keyboard used is similar to a telephone and its management is carried out by an internal matrix that gives it its name keypad matrix. These keyboards are mostly used to die because of the simplicity of their construction and their control (their cost is low enough). But why
keyboard "matrix"? A matrix is
a table of elements arranged in horizontal lines and vertical columns. For us here the matrix has twelve tiles four rows and three columns, each tile is a pusher.
As shown in Figure 4, each button is connected to two of the eight pins on the keyboard.
When the pushers are not pressed, the logic levels of pins 1-7 of the matrix are in a logic of resistance under the effect of drawing, only the 8 (which are all connected devices) is connected to ground.
When, instead pressing a button, sending the contact mass closes on both ends of each button. The PIC makes the reading and depending on the bit combination, it detects which pins are grounded and therefore push what has been pressed. Operation, after all, fairly simple and very effective. The keyboard is adopted the most basic point of view, precisely, operation, and this allows great flexibility in adapting to the needs of all types. With this model, in fact, was given a different output for each button pressed (see table in Figure 4).
The practical
to implement this program, you need the printed circuit EN1585: it is a double sided plated through holes whose face 5b-1 and 2 shows scale drawings 1. Copper-side components limited to the connector pads Conna, if you make the printed circuit yourself, you can not burn a single sided (and not welded, for lack of pellets, pins Conna side components, but only the solder side). Anyway, when you have the PCB in front of you, go first (solder side) the large connector Knows then (always solder side) both 4-pin SIMMs (they have a role mechanical, serving only to position the plate on the bus). The great
Conna 40 pin is intended, as shown in the photo of the first page, insert the plate in the experimental stage bus EN1581. Then
side components, assemble and AF CONN CONN CLV and jumper J1 (three pins). If you look closely
5a and 6 and the component list, you will have no difficulty climbing the plate.
Pay close attention to the welds of these connectors (or short-circuit between tracks or pads or cold solder joints).
Solder then the resistor network (benchmark-keyed on the lower left to J1), the two resistors, The trimmer capacitor and the polyester (no polarity). Put everything on the jumper J1 on CB (to remember). Attach this plate on the six plastic spacers.
Now place the keyboard (using the connector Male / Female 8-pin and two metal braces).
Take the small circuit board and solder the display (opposite side to the LCD) connector double male / male 16-pin, you can then place this display on the stage with the male / female connector, 16 poles and the 4 metal spacers.
one and only adjustment: after installing and fueled plate, adjust the contrast of the LCD with a small screwdriver by turning the brightness slider trimmer R1.
programs in Assembler for PIC

The three new programs that we offer for this plate are LCD.ASM the SIM.ASM and TST.ASM.
During installation you save them in the directory:


C: \\ IC-PROG \\ DEMO PRG.


LCD.ASM The program displays on the LCD:


ElectroniqueLM *** *** Microchip PIC Course
SIM.ASM The program shows him, in sequence, the seven characters DDRAM and CGRAM contents in the display driver.
With this program, the seven ASCII characters and some symbols of the Chinese alphabet is displayed. The program
TST.ASM meanwhile is a simple example of using the keyboard to the pressure of each key on the LCD is the display of the selected number or symbol.
The contents of CDR1585

A CDROM containing the programs MPLAB IDE version 7.20, IC-PROG version 1.05D and the new 1036 Proton DS Lite version is available.
In addition, the installation file IC-PROG, you will find a series of sample programs for testing and using our experimental plates including the subject of this article.
When installing IC-PROG, two directories are created automatically: - directory DEMO PRG-PROG IC contains sample programs in Assembler for PIC in. Asm and. Hex. - PRG DEMO directory contains ICPROG BASIC assembler examples rewritten in Proton Basic.



Note: for the fashion and notes for installing these programs, see INDEX.HTML present on the CDR1585, searchable with a normal browser (Internet Explorer).

0 comments:

Post a Comment