CD4094 Shift Bus Register Driver

Publisher:HeavenlySunsetLatest update time:2015-07-22 Source: 51heiKeywords:CD4094 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
//CD4094 20120302 8-way reference voltage source usage test
//program...    
#include    
#include    
#define uint  unsigned int    
#define uchar unsigned char    
 
sbit k6=P1^7;
sbit k5=P1^6;
sbit k4=P1^5;
sbit k3=P1^4;
sbit k2=P1^3;
sbit k1=P1^2;
sbit LED_ON=P1^1;
sbit led=P3^7;
sbit A_=P3^3;
sbit B_=P3^4;
sbit C_=P3^5;
sbit DEL=P1^0;


sbit STR = P3^2; //Define each port of CD4094;    
sbit DATA = P3^1;   
sbit CLK  =  P3^0;
fly tt,tt1,K=0;
uchar KEY();
  
uchar code table[]={0x03,0x9f,0x25,0x0d,0x99,0x49,0x41}; 
   
//code unsigned char C51BOX2[3] _at_ 0x43;    
void Out_4094(uchar data1); //CD4094 write data sub-function;    
void Delay(uint a); //delay sub-function;    
         //Main program starts;
 void timer0(void)  interrupt 1  using  0
{
 TH0 =5000/256;
 TL0 =5000%256;
 if(K==0)
{tt++;
 
 if(K==0&&tt==7){
  {tt=0;LED_ON=~LED_ON;}
 }
  }
  Out_4094(table[K]);
  if(K!=0) 
   LED_ON=0;
   tt1++;
   if(tt1==7){tt1=0;led=~led;}
}   
void main()   
{   
  uchar i,f,g; //infinite loop;
   TMOD=0x01;
 TH0 =5000/256;
 TL0 =5000%256;
 EA=1;
 ET0=1;
 TR0=1;
 A_=0;
 B_=0;
 C_=0;
 DEL=0;    
  while(1)    
  {   
/*for(g=0;g<6;g++)
  {Delay(30000);
    f=table[g];
    Out_4094(f); //Call the display sub-function;    
    Delay(30000); //delay;    
  }  */

  KEY();
if(K==0){A_=0;B_=0; C_=0; DEL=0  ;}
if(K==1){A_=0;B_=1; C_=1; DEL=0  ;}
if(K==2){A_=1;B_=0; C_=1; DEL=0  ;}
if(K==3){A_=0;B_=0; C_=1; DEL=0  ;}
if(K==4){A_=1;B_=1; C_=0; DEL=0  ;}
if(K==5){A_=0;B_=1; C_=0; DEL=1  ;}
if(K==6){A_=1;B_=0; C_=0; DEL=1  ;}

 
 

}
}   
void Out_4094(uchar data1) //write CD4094 sub-function;    
{   
  uchar i; //define subfunction;    
  STR=0; //Keep the current state unchanged;    
  for(i=0;i<8;i++) //Write eight bits of data into CD4094;    
  {   
   if(data1&0x01) //Judge concurrent serial data;    
    {   
   DATA=1; //Send high level;    
 }   
 else   
 {   
   DATA=0; //send low level;    
 }   
    CLK=0; //Form a rising delay pulse;    
 _nop_();   
 _nop_(); //delay;    
 _nop_();   
 CLK=1;   
 data1>>=1; //data shift, send next bit of data;    
   }   
   STR=1; //Data sent; update display;    
}   
void Delay(uint a) //delay sub-function;    
{   
  uint b;   
  for(b=0;b
				   
Keywords:CD4094 Reference address:CD4094 Shift Bus Register Driver

Previous article:DAC7611 Driver
Next article:Adc0831 (Analog-to-Digital Conversion) Driver

Recommended ReadingLatest update time:2024-11-16 16:01

Driver layer separation concept_bus driver device model_P
Hierarchical concept: The principle of driver upward registration: For example: input subroutine one input.c as a layer, the lower layer is Dev.c and Dir.c, write Dev.c and Dir.c respectively to register upward Input.c; as shown in the figure Separation concept: The concept of separation mainly talks about dividing
[Microcontroller]
Driver layer separation concept_bus driver device model_P
Introduction and comparison of several driving solutions for LED display
Introduction and comparison of several drive solutions TLC5941 driver chip The TLC5941 chip is the latest product from TI , and features dot correction, high grayscale (PWM control), etc. All internal data registers, grayscale registers, dot correction registers, and e
[Power Management]
WPG Group launches high-efficiency, ultra-thin 200W LED driver solution based on Innoscience products
On September 15, 2022, WPG Holdings, a leading semiconductor component distributor dedicated to the Asia-Pacific market, announced that its subsidiary Quan Ding has launched a high-efficiency, ultra-thin 200W LED driver power solution based on Innoscience's INN650D01 field-effect transistor. F
[Power Management]
WPG Group launches high-efficiency, ultra-thin 200W LED driver solution based on Innoscience products
Nanochip releases the new 40V automotive-grade multi-channel half-bridge driver NSD830x-Q1!
Naxin Micro has launched the new NSD830x-Q1 series of multi-channel half-bridge automotive-grade driver chips . This series of products includes two products, NSD8308 (8 channels) and NSD8306 (6 channels). Both products integrate multi-channel half-bridge drivers and N-MOS power stages to support a variety of
[Power Management]
Nanochip releases the new 40V automotive-grade multi-channel half-bridge driver NSD830x-Q1!
Impact of driver grounding point location on conducted emissions
1. Background When doing the conducted emission experiment, it was found that the PE grounding position of the driver's motor line would have a great impact on the test results, causing the test to exceed the standard. I wonder if my colleagues have encountered this. Now I will share with you the interesting sc
[Embedded]
Impact of driver grounding point location on conducted emissions
mini2440 LED Driver
myled.c #include linux/module.h #include linux/kernel.h #include linux/fs.h #include linux/cdev.h #include asm/uaccess.h #include linux/device.h #include mach/hardware.h #include mach/gpio-nrs.h #include mach/regs-gpio.h /*#include "gpio-nrs.h"*/ //add tsuibin #incl
[Microcontroller]
Driving six LEDs via two PIC pins
  This design idea shows a new method to drive six LEDs using only two MCU I/O lines. This method is especially suitable for any chip with limited pins. This method uses two I/O lines and a pair of complementary bipolar transistors. More than one LED can be lit by multiplexing.        Figure 1: The PIC10F200 is sele
[Power Management]
Driving six LEDs via two PIC pins
Renesas and Nidec Collaborate on Innovative “8-in-1” Proof of Concept to Provide Advanced Integration for Electric Vehicle Drive Motors
New electric vehicle drive motor solution will be Live demonstration at Electronica 2024 in Munich, Germany, November 12-15, 2024 Beijing, China, November 11, 2024 - Renesas Electronics, a global supplier of semiconductor solutions, today announced that it is the first in the world to lau
[Automotive Electronics]
Renesas and Nidec Collaborate on Innovative “8-in-1” Proof of Concept to Provide Advanced Integration for Electric Vehicle Drive Motors
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号