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

Some help with a VFD Please

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JeffLewcock



Joined: 10 Apr 2007
Posts: 29

View user's profile Send private message

Some help with a VFD Please
PostPosted: Tue Apr 10, 2007 1:57 pm     Reply with quote

Hi All

I need some help !

I have a 16x1 VFD display can anyone give me some ideas on how to talk to it ?

The data sheet calls the interface a Sync Serial is this the same as SPI ? or is it just simalar ?

The VFD datasheet is here www.jefflewcock.com/au1613-K2SS-04.pdf

The interface (VFD) chip datasheet as this appears to have more info is here www.jefflewcock.com/OKI_C1937_01.pdf


Any help would be appreciated !

Thanks

Jeff
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 10, 2007 2:51 pm     Reply with quote

Page 9 of the data sheet has the timing diagrams. It shows 8 clocks,
and a data line. Therefore, you can use the hardware SPI module in
the PIC.

Also on page 9, it gives a spec for the data setup before the falling
edge of SCLK. Therefore the VFD samples the data on the falling edge.
It also shows that SCLK idles at a low level. Based on that information,
you can identify the correct SPI mode from the following web page.
It's SPI mode 1.
http://www.totalphase.com/support/articles/article03/#modes

The maximum frequency of SCLK is rather low, at 500 KHz max.
So you will need to use the appropriate divisor in your setup_spi()
statement, based on your PIC's oscillator frequency. For example,
with a 4 MHz crystal, you can use the divide-by-4 divisor to get 250 KHz.
(1 MHz instruction clock / 4 = 250 KHz SCLK).

Your SPI setup would look like this:
Code:
#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
//#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#define SPI_MODE_0_0  (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_0_1  (SPI_L_TO_H)
#define SPI_MODE_1_0  (SPI_H_TO_L)
#define SPI_MODE_1_1  (SPI_H_TO_L | SPI_XMIT_L_TO_H)

//======================================
void main()
{
setup_spi(SPI_MASTER | SPI_MODE_0_1 | SPI_CLK_DIV_4); 

while(1);
}

Now you can begin to write the driver for the VFD display. You'll need
to create the POR reset pulse (see the data sheet for the required pulse
width). You also need to wait for a required amount of time after the
reset pulse is done. Then you can use the spi_write() function to send
commands and data to the chip. Note that you must wait for the
required "command processing time" after sending a command.
You can find the delay time in the data sheet.
JeffLewcock



Joined: 10 Apr 2007
Posts: 29

View user's profile Send private message

PostPosted: Tue Apr 10, 2007 3:40 pm     Reply with quote

Excellent

Thanks very much; I think I understand !

I'll give it a try tomorrow (its 2240 here)

Thanks Again

Jeff
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion 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