PicoLCD: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
The folks at [http://mini-box.com/ Mini-Box] were kind enough to respond with both schematics and source code for my PicoLCD 20x2 display. The Mini-box page lists it as "out of stock" and they have several snazzier products now but this is the one that I have.  
There are several displays going by the PicoLCD name, I have the 20 character, 2 line version (20x2). It connects to the host as a USB HID device.
 
The folks at [http://www.mini-box.com/ Mini-Box] were kind enough to respond with both schematics and source code for my PicoLCD 20x2 display. They have everything up on their web page now, see http://www.mini-box.com/picoLCD-20x2-OEM


Now I can do something fun with it. Well. Let's say "More fun."  
Now I can do something fun with it. Well. Let's say "More fun."  
I was already able to get it going on [[8track]] with the generic lcd4linux program, but I want to be able to use all the extra ports on it. What I have in mind requires programming the actual board.
I was already able to get it going on [[8track]] with the generic lcd4linux program, but I want to be able to use all the extra ports on it. What I have in mind requires programming the actual board.


Some specs:
== Features ==


LCD: 20 characters wide, 2 rows, with backlight <br>
LCD: 20 characters wide, 2 rows, with backlight <br>
Line 13: Line 15:
IR port<br>
IR port<br>


There are many interesting features on this board considering on the surface it's just a 20x2 LCD. A companion product from Mini-box is a board with buttons and an IR receiver on it. I don't have one of those, and it would not fit in 8track anyway.
[https://www.fairchildsemi.com/datasheets/NC/NC7SZ384.pdf One bit switch NC7SZ384]: The board has connectors for "power in", "power out", and a "power button". The power in and and out are wired up to the switch. The "power button" is simply connected to a port on the CPU. From the docs I think Mini-box intended this to work with the host PC power connections.
== USB connection to host ==
There are cables available but alas I neglected to order any.
The Mini-box docs show a 5 pin connection, but my board has only 4 pins, no ground wire so I ignore that connection. On my Epia motherboard I connected to the on board USB using a 6 pin cable that I had handy. The Epia gives me 4 options, I choose a set up that leave the other three available. It looks like this
LCD    CABLE  EPIA
       
1 V+  6 YE    10
2 D-  5 GN    12
3 D+  4 WH    14
4 V-  3 BK    16
5 GND  2 OR    nc
        1 RD    nc
== Using the PicoLCD with lcd4linux ==
Not going to go into a lot of detail here, but this is available for most Linux distributions and it supports the PicoLCD 20x2.
You have to enable the 20x2 by commenting out the default setup line and uncommented the 20x2 line in the lcd4linux config file.


There are many interesting features on this board considering on the surface it's just a 20x2 LCD. A companion product from Mini-box is a board with buttons and an IR receiver on it. I don't have one of those, and it would not fit in 8track anyway.
Then you can pick and choose what you want displayed from the included tools or write scripts for lcd4linux to run.
 
== Working with the SDK ==
 
Mini-box provides an SDK so that you can write your own host-based code. The SDK includes a simple sample program.
 
You can use the sample program instead of lcd4linux if you don't want to do programming.
== Programming the PicoLCD ==
 
You need a development system to run Microchip's PIC development tools. I use the MPLAB X version on Linux. I use the XC 8 compiler. All free now.
 
Minibox provides a separate bootloader and firmware.
Minibox used the C18 compiler. I wonder how XC8 compares?
 
=== Bootloader ===
 
There is an app note from Microchip on bootloaders. http://ww1.microchip.com/downloads/cn/AppNotes/cn_00851b.pdf
 
The bootloader is stored in 256 bytes protected memory and it will load new firmware into program flash; that way you don't need an ICSP programmer to put new firmware into the PicoLCD.
 
Reading the bootloader source code: It will try to load new firmware via USB if
1. "Flasher is Summoned" I have no idea what this means
OR 2. You hold down the up/down keys at boot time
OR 3. there is no program in firmware
 
This bootloader looks like it came straight from Microchip, with a customized user/user.c file.
 
== Port assignments ==
 
{| Border=1
|-
| RA0 || LED0 || output ||
|-
| RA1 || LED1 || output || transistor driver
|-
| RA2 || LED2 || output ||
|-
| RA3 || LED3 || output ||
|-
| RA4 || LED4 || output ||
|-
| RB5 || LED5 || output ||
|-
|-
| RB0 || I2C SDA || || I2C serial data
|-
| RB1 || I2C SCL || || I2C serial clock
|-
| RB2 || || ||
|-
| RB3 || LCD BIAS|| output ||
|-
| RB4 || PWR0 || output || controls power switch
|-
| RB5 || PWR1 || input || push button "power"
|-
| RB6 || ICD PGC || input || ICD pin 6
|-
| RB7 || ICD PGD || input || ICD pin 4
|-
|-
| RC4 || USB D- || output || USB connector
|-
| RC5 || USB D+ || input || USB connector
|-
| RC6 || SERIAL TX || output || USART connector
|-
| RC7 || SERIAL RX || input || USART connector
|-
|-
| RD0 || ROW1 || input || keypad scan and lcd scan
|-
| RD1 || ROW2 || input || keypad scan and lcd scan
|-
| RD2 || ROW3 || input || keypad scan and lcd scan
|-
| RD3 || ROW4 || input || keypad scan and lcd scan
|-
| RD4 || COL1 || output || keypad scan
|-
| RD5 || COL2 || output || keypad scan
|-
| RD6 || COL3 || output || keypad scan
|-
| RD7 || COL4 || output || keypad scan
|-
|-
| RE0 || LCD RS || output ||
|-
| RE1 || LCD EN || output ||
|-
| RE2 || LCD Backlight || output ||
|}


One bit switch NC7SZ384: The board has connectors for "power in", "power out", and a "power button". The power in and and out are wired up to the switch. The "power button" is simply connected to a port on the CPU.
== Power switch ==


'''to be continued'''
There is a NC7SZ384 power switch on the board that can switch up to 128 ma and 0-7v.
It is on port RB4; you can turn on and off some accessory of your choice using this switch.
There is a "power button" on RB5, it's just another pushbutton grouped with the power switch.

Latest revision as of 18:32, 27 July 2015

There are several displays going by the PicoLCD name, I have the 20 character, 2 line version (20x2). It connects to the host as a USB HID device.

The folks at Mini-Box were kind enough to respond with both schematics and source code for my PicoLCD 20x2 display. They have everything up on their web page now, see http://www.mini-box.com/picoLCD-20x2-OEM

Now I can do something fun with it. Well. Let's say "More fun." I was already able to get it going on 8track with the generic lcd4linux program, but I want to be able to use all the extra ports on it. What I have in mind requires programming the actual board.

Features

LCD: 20 characters wide, 2 rows, with backlight
CPU: Microchip 18F4550 (Microchip page)
This chip has 32K of Flash, 2K RAM, a 13 channel 10-bit ADC, a couple comparators, and of course the 11Mbps USB port.
One bit switch
64k EEPROM
IR port

There are many interesting features on this board considering on the surface it's just a 20x2 LCD. A companion product from Mini-box is a board with buttons and an IR receiver on it. I don't have one of those, and it would not fit in 8track anyway.

One bit switch NC7SZ384: The board has connectors for "power in", "power out", and a "power button". The power in and and out are wired up to the switch. The "power button" is simply connected to a port on the CPU. From the docs I think Mini-box intended this to work with the host PC power connections.

USB connection to host

There are cables available but alas I neglected to order any.

The Mini-box docs show a 5 pin connection, but my board has only 4 pins, no ground wire so I ignore that connection. On my Epia motherboard I connected to the on board USB using a 6 pin cable that I had handy. The Epia gives me 4 options, I choose a set up that leave the other three available. It looks like this

LCD    CABLE  EPIA
        
1 V+   6 YE    10
2 D-   5 GN    12
3 D+   4 WH    14
4 V-   3 BK    16
5 GND  2 OR    nc
       1 RD    nc

Using the PicoLCD with lcd4linux

Not going to go into a lot of detail here, but this is available for most Linux distributions and it supports the PicoLCD 20x2.

You have to enable the 20x2 by commenting out the default setup line and uncommented the 20x2 line in the lcd4linux config file.

Then you can pick and choose what you want displayed from the included tools or write scripts for lcd4linux to run.

Working with the SDK

Mini-box provides an SDK so that you can write your own host-based code. The SDK includes a simple sample program.

You can use the sample program instead of lcd4linux if you don't want to do programming.

Programming the PicoLCD

You need a development system to run Microchip's PIC development tools. I use the MPLAB X version on Linux. I use the XC 8 compiler. All free now.

Minibox provides a separate bootloader and firmware. Minibox used the C18 compiler. I wonder how XC8 compares?

Bootloader

There is an app note from Microchip on bootloaders. http://ww1.microchip.com/downloads/cn/AppNotes/cn_00851b.pdf

The bootloader is stored in 256 bytes protected memory and it will load new firmware into program flash; that way you don't need an ICSP programmer to put new firmware into the PicoLCD.

Reading the bootloader source code: It will try to load new firmware via USB if

1. "Flasher is Summoned" I have no idea what this means
OR 2. You hold down the up/down keys at boot time
OR 3. there is no program in firmware

This bootloader looks like it came straight from Microchip, with a customized user/user.c file.

Port assignments

RA0 LED0 output
RA1 LED1 output transistor driver
RA2 LED2 output
RA3 LED3 output
RA4 LED4 output
RB5 LED5 output
RB0 I2C SDA I2C serial data
RB1 I2C SCL I2C serial clock
RB2
RB3 LCD BIAS output
RB4 PWR0 output controls power switch
RB5 PWR1 input push button "power"
RB6 ICD PGC input ICD pin 6
RB7 ICD PGD input ICD pin 4
RC4 USB D- output USB connector
RC5 USB D+ input USB connector
RC6 SERIAL TX output USART connector
RC7 SERIAL RX input USART connector
RD0 ROW1 input keypad scan and lcd scan
RD1 ROW2 input keypad scan and lcd scan
RD2 ROW3 input keypad scan and lcd scan
RD3 ROW4 input keypad scan and lcd scan
RD4 COL1 output keypad scan
RD5 COL2 output keypad scan
RD6 COL3 output keypad scan
RD7 COL4 output keypad scan
RE0 LCD RS output
RE1 LCD EN output
RE2 LCD Backlight output

Power switch

There is a NC7SZ384 power switch on the board that can switch up to 128 ma and 0-7v. It is on port RB4; you can turn on and off some accessory of your choice using this switch. There is a "power button" on RB5, it's just another pushbutton grouped with the power switch.