Menu
Description
Bill of material
Display board
CPU board
Cabling
Mechanical
Power up
Software
User Guide
Top Menu
Home
|
FCALLBOX3 Display Box
Description :
This page details the commands functions for the FCallbox display, they are provided for Linux, but they can easily ported on Windows.
Setup
The FCallbox display is controled by a serial COM port in TTL mode (not in RS232), but you can used the FTDI adpator described in the menu : Power up.
The port configuration is : 115200bps, 8 bits, no parity, 1 stop bit.
Here the includes to put at the beginning of your program (note that not all are used) :
#include ‹stdio.h›
#include ‹string.h›
#include ‹stdlib.h›
#include ‹fcntl.h›
#include ‹unistd.h›
#include ‹sys/ioctl.h›
#include ‹sys/poll.h›
#include ‹unistd.h›
#include ‹sys/types.h›
#include ‹sys/stat.h›
#include ‹sys/un.h›
#include ‹getopt.h›
#include ‹errno.h›
#include ‹termios.h›
#include ‹sys/socket.h›
#include ‹netdb.h›
#include ‹time.h›
// DISPLAY GRAPHICS Defines
#define SIZE_DISPLAY_GRAPHICS 8
#define GRAPHICS_MODE 2
#define TEXT_MODE 0
|
Function for COM open :
/****************/
/* Open serial port */
/****************/
void OpenPort (char * device)
{
fd_serial = open(device, O_RDWR | O_NOCTTY | FNDELAY);
if (fd_serial < 0)
{
printf ("Error openning device : %s\n",device);
exit(0);
}
bzero(&newtio,sizeof(newtio));
newtio.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR | ICRNL;
newtio.c_oflag = 0;
newtio.c_lflag = 0;;
newtio.c_cc[VMIN]=1;
newtio.c_cc[VTIME]=0;
tcflush(fd_serial, TCIFLUSH);
tcsetattr(fd_serial,TCSANOW,&newtio);
}
|
AVAILABLES COMMANDS
The commands are done with two bytes , first is cmd second is data, the availables comands are following :
// COMMANDS DEFINES
#define SET_CHAR_0 0x01
#define SET_CHAR_1 0x02
#define SET_CHAR_2 0x03
#define SET_CHAR_3 0x04
#define SET_CHAR_4 0x05
#define SET_CHAR_5 0x06
#define SET_CHAR_6 0x07
#define SET_CHAR_7 0x08
#define SET_HEURE_DIZAINE 0x09
#define SET_HEURE_UNIT 0x0A
#define SET_MINUTE_DIZAINE 0x0B
#define SET_MINUTE_UNIT 0x0C
#define SET_SECONDE_DIZAINE 0x0D
#define SET_SECONDE_UNIT 0x0E
#define START_STOP_TIME_COMPUTE 0x0F
#define START_STOP_GRAPHICS 0x10
#define START_WRITE_GRAPHICS 0x11
#define DATA_WRITE_GRAPHICS 0x12
#define DISPLAY_ON_OFF 0x13
#define CHECK_SYNC 0x14
#define RESET 0x15
#define GET_VERSION 0x16
|
To send with the code following :
int DisplaySendCommandData (int Cmd,int data)
{
char c [10];
c[0] = (char) Cmd;
c[1] = 0;
write(fd_serial,&c,1); //write 1 byte to the serial port
RS232_delay_bit();
c[0] = (char) data;
c[1] = 0;
write(fd_serial,&c,1); //write 1 byte to the serial port
RS232_delay_bit();
return 1;
}
|
MODE SELECTION COMMANDS
- Mode Texte or graphic :
/*************************/
/* set DISPLAY IN TEXT MODE */
/*************************/
void Set_Display_TEXT_MODE(void)
{
DisplaySendCommandData (START_STOP_GRAPHICS,TEXT_MODE); // text mode
}
|
/*****************************/
/* set DISPLAY IN GRAPHICS MODE */
/*****************************/
void Set_Display_GRAPHICS_MODE(void)
{
DisplaySendCommandData (START_STOP_GRAPHICS,GRAPHICS_MODE); // graphic mode
}
|
- Mode Start or stop time:
/********************/
/* DISPLAY START TIME */
/********************/
void Display_START_TIME(void)
{
DisplaySendCommandData (START_STOP_TIME_COMPUTE,0x00);
}
|
/*******************/
/* DISPLAY STOP TIME */
/*******************/
void Display_STOP_TIME(void)
{
DisplaySendCommandData (START_STOP_TIME_COMPUTE,0x01);
}
|
- Mode Clear display :
/***************/
/* Clear DISPLAY */
/***************/
void Display_CLEAR(void)
{
DisplaySendCommandData(DISPLAY_ON_OFF,0x00); // clear display Graphics
}
|
TEXT COMMANDS
- Command to display a string :
/*******************************/
/* Send Text datas to Display matrix */
/*******************************/
void SendTextDisplayMatrix(char * sText)
{
int i;
char Text[8];
// fill end of text with space if lenght < 8
for (i=0;i<8;i++)
{
if (i>=strlen(sText))
Text[i]=' ';
else
Text[i]=sText[i];
}
DisplaySendCommandData (SET_CHAR_0,Text[0]);
DisplaySendCommandData (SET_CHAR_1,Text[1]);
DisplaySendCommandData (SET_CHAR_2,Text[2]);
DisplaySendCommandData (SET_CHAR_3,Text[3]);
DisplaySendCommandData (SET_CHAR_4,Text[4]);
DisplaySendCommandData (SET_CHAR_5,Text[5]);
DisplaySendCommandData (SET_CHAR_6,Text[6]);
DisplaySendCommandData (SET_CHAR_7,Text[7]);
}
|
GRAPHICS COMMANDS
- The matrix 5x7 organisation is :
- First byte corresponds to the first Column at the left (byte 0)
- its bits correspond to the leds on top (b7) on bottom (b1), b0 is not used.
- Command to reset the index (from 1 to 39 bytes)
/*********************/
/* reset GRAPHICS index */
/*********************/
void Display_RESET_GRAPHICS_INDEX(void)
{
DisplaySendCommandData(START_WRITE_GRAPHICS,0x00); // reset indx
}
|
- Command to send a byte
/*********************/
/* write data graphics */
/*********************/
void Display_WRITE_GRAPHICS(int data)
{
DisplaySendCommandData(DATA_WRITE_GRAPHICS,data);
}
|
- For the implementation of a new graphic generated with the tool described at the end of the menu Softwares,
The file has the format following :
0xFE,0xC2,0xA2,0x92,0x8A,0x92,0xA2,0xC2,0xFE,0x20,0x7E,0xA0,0xB8,0xA0
|
- You have to put it in an array :
char My_graphic[] = { 0xFE,0xC2,0xA2,0x92,0x8A,0x92,0xA2,0xC2,0xFE,0x20,0x7E,0xA0,0xB8,0xA0 };
|
- And use the code following to send the graphic to the Display :
// clear Display buffer
for (i=0;i<40;i++)
Graphics[i] = 0;
// Display graphics counter
indx=1;
// PARENT ICON
for (i=0;i<strlen( My_graphic);i++)
Graphics[indx++]= My_graphic[i];
Graphics[indx++]=0;
// Send data Display graphics
Display_RESET_GRAPHICS_INDEX(); // reset indx
for (i=0;i<5;i++)
{
for (j=7;j>=0;j--)
Display_WRITE_GRAPHICS(Graphics[j*5+i]); // colonn 5*0+1
}
Set_Display_GRAPHICS_MODE();
|
|