CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

IEE FLIP VFD 1x16 Screen driver

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

IEE FLIP VFD 1x16 Screen driver
PostPosted: Tue Aug 19, 2014 11:32 am     Reply with quote

Hi All,

This is a little serial driver for a VFD screen I had.

You can see the screen in action here:
https://hackaday.io/project/2391-VFD-Shenanigans

It just sees the incoming characters and if there is a comma or period it substitutes the previous character with the corresponding character value that includes a comma.

In other words it allows you to display data like:

[A, B, C. D.]

Instead of

[A , B , C . D .]

Without this "driver" the commas and periods would use an entire character space on their own.


Test Program:

Code:
#include <16f886.h>
#device adc=8
#device *=16

#fuses HS,NOWDT,NOPROTECT,NOLVP,NOBROWNOUT,NODEBUG

#use delay(clock=20000000)

#include "FLIP_VFD_1x16.c"
   
//==========================


void main()
{
    while(1)
    {
   
      putc(EOL_MODE3);      // set screen wraping mode

      //Test escape characters
      Printf(Subset,"\n\r---- \' \" \\ ----");
      delay_ms(3000);

      //Test Symbols with periods & commas   
      Printf(Subset,"\n\r#,. ,?,.%,$.*,/.+.-,}{_.(,");
      delay_ms(3000);

      //Test Letters with periods & commas
      Printf(Subset,"\n\ra,b,c,x,y,z,@.A.B.C.X.Y.Z.");
      delay_ms(3000);

    }
}



Driver:

Code:
#define COMM_PIN    PIN_B0   // Serial pin to talk to VFD

#define CLR_DISPLAY 0x0A    // AKA: Line Feed - '\n'
#define CR_RETURN   0x0D    // AKA: Return '\r'
#define BACK_SPACE    0x08
#define FWD_SPACE    0x09
#define BLINK      0x0B
#define NO_BLINK    0x0C
#define VIEW_CURSOR   0x0F
#define HIDE_CURSOR 0x0E

#define EOL_MODE1    0x11   // Default - Automatic CR
#define EOL_MODE2    0x12   // Overwrite Rightmost char
#define EOL_MODE3    0x13   // Scroll right to left


#use rs232(baud=1200, xmit=COMM_PIN,STOP=2, ERRORS) // Software Serial

char Previous_Char;         // Global Var
void Subset(char);         // Fuction Declaration


void Subset(char Next_Char)
{
   if((Next_Char=='.')&&(Previous_Char<0x80)&&(Previous_Char!='.'))
   {
      putc(BACK_SPACE);
         if((Previous_Char>0x60)&&(Previous_Char<0x7B))
         {
            Previous_Char-=0x20;
         }
      Next_Char=Previous_Char|0x80;
   }

   if((Next_Char==',')&&(Previous_Char>0x3F)&&(Previous_Char!=','))
   {
      putc(BACK_SPACE);
         
         if((Previous_Char>0x60)&&(Previous_Char<0x7B))
         {
            Previous_Char-=0x20;
         }
      Next_Char=Previous_Char|0xA0;
   }

   if((Next_Char==',')&&(Previous_Char<0x40)&&(Previous_Char!=','))
   {
      putc(BACK_SPACE);
      Next_Char=Previous_Char+0x60;
   }

   putc(Next_Char);
   Previous_Char=Next_Char;
}



G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group