| ??? 09/21/11 12:39 Read: times | #183834 - ISR changed, FILAMENT IS... Responding to: ???'s previous message | 
| 
#include <c:c51incstdio.h>
#include <c:c51increg52.h>
#include <c:c51incintrins.h>
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long int
#define CS      P24
#define CLK     P25
#define DATA    P26
#define GRID    P20
uchar   ms100,
        datareg,
        data_buffer1,
        vfdcounter;
uint    ms10;
bit     firsttime, 
        TIMERIRQHAPPENS;
int     init_vfd(),        
        write_vfd1(),
        data2vfd(),
        display();
init_vfd()
{
CS = 0;
data_buffer1 = 0x05;    //9 digit & 13 segment selection
data2vfd();
CS = 1;
}
write_vfd1()
{
CS = 0;
data_buffer1 = 0x44;    //fix address type
data2vfd();
CS = 1;
_nop_();
_nop_();
CS = 0;
data_buffer1 = 0xc0;   //dispaly address 0
data2vfd();
data_buffer1 = datareg; //actual data to write
data2vfd();
CS = 1;
_nop_();
_nop_();
CS = 0;
data_buffer1 = 0x8f;    //display on & pulsewidth = 14/16
data2vfd();             
CS = 1;
}
data2vfd()
{
vfdcounter = 0x08;
while(vfdcounter != 0)
        {        
        CLK = 0;
        DATA = data_buffer1 & 0x01;
        CLK = 1;
        --vfdcounter;
        data_buffer1 = data_buffer1 >> 1;       //left shift
        }
}                                   
void main(void)
{
SP = 0xa0;
TMOD = 0x01;    //0000 0001
TR0 = 1;
TH0 = 0xec;
TL0 = 0x78;
P0 = 0xff;
P1 = 0xff;
P2 = 0xff;
P3 = 0xff;
init_vfd();
P37 = 0;                        //Not the part of VFD program
firsttime = 1; 
TIMERIRQHAPPENS=0;
IE = 0x82;
for(;;)
  {
  IF (TIMERIRQHAPPENS)
    {
     DISPLAY()
     TIMERIRQHAPPENS=0;
    };
  }
  ;        
}
timecalc() interrupt 1 using 1
{
TH0 = 0xfc;
TL0 = 0x17;
GRID = 1;
++ms100;
if(ms100 == 15)
        {
        GRID = 0;
        ms100 = 0;
        //////////////DONT CALL ANYTING FROM ISR/////////////display();
         TIMERIRQHAPPENS=1;
        }
}
display()
{
if(firsttime)
        {
        datareg = 0x3f; //code for 0
        write_vfd1();
        firsttime = 0;
        }
}
 WHAT IS FILAMENT .... http://en.wikipedia.org/wiki/Vacuum_fluorescent_display | 
| Topic | Author | Date | 
| How to control Grid voltage of VFD | 01/01/70 00:00 | |
| what You mean? | 01/01/70 00:00 | |
| bought as module or built by you? | 01/01/70 00:00 | |
| voltage is steady | 01/01/70 00:00 | |
| RE: "I purchase it from market" | 01/01/70 00:00 | |
| I have | 01/01/70 00:00 | |
| how | 01/01/70 00:00 | |
| code | 01/01/70 00:00 | |
| GO OUT FROM INTERRUPT | 01/01/70 00:00 | |
| filament power ? | 01/01/70 00:00 | |
| ISR changed, FILAMENT IS... | 01/01/70 00:00 | |
| Link about VFD | 01/01/70 00:00 | |
| what i should read there? | 01/01/70 00:00 | |
| Same problem with modified code | 01/01/70 00:00 | |
| Work on hardware | 01/01/70 00:00 | |
| show pictures | 01/01/70 00:00 | |
| DC connection | 01/01/70 00:00 | |
| Near to solution | 01/01/70 00:00 | |
| just a thought | 01/01/70 00:00 | |
| Thanks | 01/01/70 00:00 | |
| Modified program | 01/01/70 00:00 | |
| make report | 01/01/70 00:00 | |
| about Filament | 01/01/70 00:00 | |
| RE:about filament | 01/01/70 00:00 | |
| PWM   | 01/01/70 00:00 | 



