NSLU2 as i2c master driving a local PIC microprocessor as an i2c slave with attached
graphic display responding to primitive graphics commands
Have a PIC local to the i2c master running as an i2c slave, driving a 64 x 128 graphic display.
The PIC/display combination responds to requests from the master to draw a graphical shape or ASCII character at some point x, y
Earlier attempts reported here required the creation of a control program for the I2C master AND a second customised
program for the PIC that responds to the commands. The PIC program was limited by local PIC memory.
This record is for my backup - this project is NOT fully complete and tested
but seems to work well enough to be tested in my greenhouse control application
i2c_graphic_primitive.C is the program for the PIC and it draws a line, rectangle, circle, point or ASCII character when
it receives a string of bytes on the i2c line from the master
glcd_primitives.c is the program on the i2c master (a nslu2 running Debian in this test)
blassic_graphic_primitive.bas is a Blassic basic control program for the i2c master to test the display (remove the .txt).
blassic_graphic_primitive.bas causes the Linux system to run command line requests like -
Slug52local:/home/graham/primitive# ./glcd_primitives 81 5 64 56 72 1 1 0
The first argument (81) is the decimal i2c address of the PIC connected to the 64x128 graphical display
The second argument determines which graphical element should be drawn.
These are as below :-
1 line(x1 y1 x2 y2 color(0/1))
2 rectangle (x1 y1 x2 y2 fill(0/1) color(0/1)
3 bar(x1 y1 x2 y2 width color(0/1) - - - fails, why?
4 circle(x y radius fill(0/1) color(0/1))
5 text to screen (x y ASCIIasDecimal size color(0/1)) -e.g. send 65 for A
6 pixel (x y color(0/1))
7 wipe all screen to black or white (color(0/1))
8 arguments are needed - for elements such as circle dummy arguments of value zero are added at the end
1 - painting a screen takes several seconds
2 - if text is included and the Blassic test program is set to loop then after about 20 loops the PIC crashes while printing a character to screen - please tell me why!
- but my main application only needs setting up a few times so I can live with that.....
EDIT - SORTED! - You cannot do an i2c interrupt while the PIC is processing text or the AtoD - I now only do those after a specific command from the i2c master has been received by the PIC - and then make the master wait for a while for the pocess to complete.
These project notes are put here for my secure backup during debelopment - but if you find them of use or can spot the mistakes of a C novice (!) please email me
To run the Graphic screen plus PIC from a Sweex/Edimax router you only need to change the dev address
- you can also change the headers and it still works (I am not sure what each of them does....)
These both work on the Sweex
glcd_primitives_Sweex.c - - - - - - >glcd_primitives_Sweex
glcd_primitives.c- - - - - - - - - - - - - >glcd_primitives
back to slug menu