打印
[MCU新闻]

N76E616带LCD驱动

[复制链接]
1511|10
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主


沙发
xixi2017|  楼主 | 2017-6-26 11:04 | 只看该作者

新唐N76E616高速1T 8051单片机系列,自带LCD显示屏驱动电路,提供高达 -40~105℃ 的工作温度范围,以满足严苛的工业电子应用环境。宽电压工作范围 2.4V 至 5.5V、11.059 MHz内建RC晶振、并内建Data Flash、欠压检测、高抗干扰能力(ESD HBM 8KV, MM 400V/EFT 4KV)、支持在线系统编程(ISP) 、支持在线应用程序更新(IAP)和在线电路编程(ICP),提供LQFP48封装。

应用领域 :

工业控制、家电、仪器仪表、温度控制、电源管理等领域。

关键特性:

  • 内核(core)
    • 1 T 8051 微 处理器
    • 工件频率 可达 16MHz
    • 工作电压 : 2.4V to 5.5V
    • 工作温度 : -40 ℃ ~105 ℃
  • 内存(memory)
    • 18 KB 应用 程序
    • 内嵌 512B SRAM
    • 可配置 的 Data Flash
    • 支持 在线系统编程 ISP(In-System Programming)
    • 支持 在线电路编 ICP(In-Circuit Programming)
    • 支持在线应用程序更新 IAP(In-Application Programming)
  • 模数转换器(ADC)
    • 提供 8 通道
    • 10 位分辨率
    • 可达 150 k SPS ( 每秒采样率 )
  • LCD 驅動能力
    • 3x32, 4x32和6x30 COM/SEG LCD
  • 通讯接口(connectivity)
    • 一组 I²C ( 可达 400 kHz)
    • 二组 UART
  • 时钟控制(clock control)
    • 外部晶振 2 to 16 MHz
    • 全温全压 ± 5 % 11.059 MHz 内 RC 晶振
    • 支持 32.768 kHz 外部晶振

使用特权

评论回复
板凳
xixi2017|  楼主 | 2017-6-26 11:04 | 只看该作者
地板
643757107| | 2017-6-26 18:39 | 只看该作者
小家电都是要性价比高的,新唐的完全可以。

使用特权

评论回复
5
643757107| | 2017-6-26 18:42 | 只看该作者
/*---------------------------------------------------------------------------------------------------------*/
/*                                                                                                         */
/* Copyright(c) 2015 Nuvoton Technology Corp. All rights reserved.                                         */
/*                                                                                                         */
/*---------------------------------------------------------------------------------------------------------*/

//***********************************************************************************************************
//  Nuvoton Technoledge Corp.
//  Website: http://www.nuvoton.com
//  E-Mail : MicroC-8bit@nuvoton.com
//  Date   : Sep/1/2015
//***********************************************************************************************************

//***********************************************************************************************************
//  File Function: N76E616 ADC demo code
//***********************************************************************************************************

#include <stdio.h>
#include "N76E616.h"
#include "Version.h"
#include "Typedef.h"
#include "Define.h"
#include "SFR_Macro.h"
#include "Common.h"
#include "Delay.h"

/*
//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
//
//<e0> System Clock Source Configuration
// <o1> System Clock Source Selection
//      <0=> 2~16MHz    XTAL
//      <1=> 32.768KHz  XTAL
//      <2=> 11.0592MHz Internal
//      <3=> 10KHz      Internal
//      <4=> OSC-In     External
//</e>
//
//<e2> Clock Divider Configuration
//     <o3.0..7>  System Clock Source Devider <1-255:1>
//                     <i> Fsys = (System Clock Source) / (2 * Devider)
//</e>
//
//<h> ADC Option
// <o4.0..3> ADC Pin Selection
//      <0=> AIN0 (P00) <1=> AIN1 (P01) <2=> AIN2 (P02) <3=> AIN3 (P03)
//      <4=> AIN4 (P04) <5=> AIN5 (P05) <6=> AIN6 (P06) <7=> AIN7 (P07)
//      <8=> AIN8 (P26) <9=> AIN9 (P20) <10=> Band-Gap
//
// <o5.0..2> ADC Divider Selection
//      <0=> Fsys/1  <1=> Fsys/2   <2=> Fsys/4   <3=> Fsys/8
//      <4=> Fsys/16 <5=> Fsys/32  <6=> Fsys/64  <7=> Fsys/128
//
//</h>
//
//-------- <<< end of configuration section >>> ------------------------------
*/

#define SYS_CLK_EN      0
#define SYS_SEL         2
#define SYS_DIV_EN      0                   //0: Fsys=Fosc, 1: Fsys = Fosc/(2*CKDIV)
#define SYS_DIV         1

#define ADC_PIN         0
#define ADC_DIV         2

bit BIT_TMP;
/******************************************************************************
* FUNCTION_PURPOSE: ADC interrupt Service Routine
******************************************************************************/
void ADC_ISR (void) interrupt 11
{
    clr_ADCF;                               //clear ADC interrupt flag
}
/******************************************************************************
* FUNCTION_PURPOSE: ADC Pin Select
******************************************************************************/
void ADC_Pin_Select (void)
{
    #if   ADC_PIN == 0                      //P0.0
          ADCCON0 = 0x00;                   //select ADC pin
          set_P0M1_0;                       //set ADC pin is input only mode
          clr_P0M2_0;
          set_P00DIDS;                      //disable digital connection
    #elif ADC_PIN == 1                      //P0.1
          ADCCON0 = 0x01;                   //select ADC pin
          set_P0M1_1;                       //set ADC pin is input only mode
          clr_P0M2_1;
          set_P01DIDS;                      //disable digital connection
    #elif ADC_PIN == 2                      //P0.2
          ADCCON0 = 0x02;                   //select ADC pin
          set_P0M1_2;                       //set ADC pin is input only mode
          clr_P0M2_2;
          set_P02DIDS;                      //disable digital connection
    #elif ADC_PIN == 3                      //P0.3
          ADCCON0 = 0x03;                   //select ADC pin
          set_P0M1_3;                       //set ADC pin is input only mode
          clr_P0M2_3;
          set_P03DIDS;                      //disable digital connection
    #elif ADC_PIN == 4                      //P0.4
          ADCCON0 = 0x04;                   //select ADC pin
          set_P0M1_4;                       //set ADC pin is input only mode
          clr_P0M2_4;
          set_P04DIDS;                      //disable digital connection
    #elif ADC_PIN == 5                      //P0.5
          ADCCON0 = 0x05;                   //select ADC pin
          set_P0M1_5;                       //set ADC pin is input only mode
          clr_P0M2_5;
          set_P05DIDS;                      //disable digital connection
    #elif ADC_PIN == 6                      //P0.6
          ADCCON0 = 0x06;                   //select ADC pin
          set_P0M1_6;                       //set ADC pin is input only mode
          clr_P0M2_6;
          set_P06DIDS;                      //disable digital connection
    #elif ADC_PIN == 7                      //P0.7
          ADCCON0 = 0x07;                   //select ADC pin
          set_P0M1_7;                       //set ADC pin is input only mode
          clr_P0M2_7;
          set_P07DIDS;                      //disable digital connection
    #elif ADC_PIN == 8                      //P2.6
          ADCCON0 = 0x08;                   //select ADC pin
          set_P2M1_6;                       //set ADC pin is input only mode
          clr_P2M2_6;
          set_P26DIDS;                      //disable digital connection
    #elif ADC_PIN == 9                      //P2.0
          ADCCON0 = 0x09;                   //select ADC pin
          set_P2M1_0;                       //set ADC pin is input only mode
          clr_P2M2_0;
          set_P20DIDS;                      //disable digital connection
    #else
          ADCCON0 |= 0x0F;                  //band-gap 1.25V
    #endif
}
/******************************************************************************
* FUNCTION_PURPOSE: ADC Clock Divider Select
******************************************************************************/
void ADC_DIV_Select (void)
{
    #if   ADC_DIV == 0
          clr_ADCDIV2;
          clr_ADCDIV1;
          clr_ADCDIV0;
    #elif ADC_DIV == 1
          clr_ADCDIV2;
          clr_ADCDIV1;
          set_ADCDIV0;
    #elif ADC_DIV == 2      //Default
          clr_ADCDIV2;
          set_ADCDIV1;
          clr_ADCDIV0;
    #elif ADC_DIV == 3
          clr_ADCDIV2;
          set_ADCDIV1;
          set_ADCDIV0;
    #elif ADC_DIV == 4
          clr_ADCDIV2;
          clr_ADCDIV1;
          set_ADCDIV0;
    #elif ADC_DIV == 5
          set_ADCDIV2;
          clr_ADCDIV1;
          clr_ADCDIV0;
    #elif ADC_DIV == 6
          set_ADCDIV2;
          clr_ADCDIV1;
          set_ADCDIV0;
    #elif ADC_DIV == 7
          set_ADCDIV2;
          set_ADCDIV1;
          clr_ADCDIV0;
    #elif ADC_DIV == 8
          set_ADCDIV2;
          set_ADCDIV1;
          set_ADCDIV0;
    #endif
}
/******************************************************************************
* FUNCTION_PURPOSE: ADC Initial
******************************************************************************/
void ADC_Initial (void)
{
    set_ADCEN;
    ADC_Pin_Select();                           //Select ADC Pin
    ADC_DIV_Select();                           //Set ADC Clock Divider
}

/******************************************************************************
The main C function.  Program execution starts
here after stack initialization.
******************************************************************************/
void main (void)
{
    UINT8 i;
   
    /* Note
       MCU power on system clock is HIRC (11.0592MHz), so Fsys = 11.0592MHz
    */
   
    Set_All_GPIO_Quasi_Mode();

    #if DEBUG_PORT == 0
        InitialUART0_Timer1_Type1(9600);            /* 9600 Baud Rate*/
    #elif DEBUG_PORT == 1
        InitialUART1_Timer3(9600);                  /* 9600 Baud Rate*/
    #endif

    Show_FW_Version_Number_To_PC();

    printf ("\n*===================================================================");
    printf ("\n*  Name: N76E616 ADC Demo Code.");
    printf ("\n*===================================================================\n");
   
    /* Change system closk source */
    #if SYS_CLK_EN == 1
        #if   SYS_SEL == 0
            System_Clock_Select(E_HXTEN);   //Fosc = 2~16MHz XTAL
        #elif SYS_SEL == 1
            System_Clock_Select(E_LXTEN);   //Fosc = 32.768KHz XTAL
        #elif SYS_SEL == 2
            System_Clock_Select(E_HIRCEN);  //Fosc = 11.0592MHz Internal RC
        #elif SYS_SEL == 3
            System_Clock_Select(E_LIRCEN);  //Fosc = 10KHz Internal RC
        #elif SYS_SEL == 4
            System_Clock_Select(E_OSCEN);   //Fosc = OSC-In External OSC
        #endif
    #endif
   
    #if SYS_DIV_EN == 1
        CKDIV = SYS_DIV;                        //Fsys = Fosc / (2* CLKDIV) = Fcpu
    #endif
   
    for(i=0;i<3;i++)
    {
        P02 = 0;
        Timer0_Delay1ms(200);
        P02 = 1;
        Timer0_Delay1ms(200);
    }

    ADC_Initial();
   
    while(1)
    {
        clr_ADCF;
        set_ADCS;                               //Trigger ADC start conversion
        #if 0                                   //Polling
            while(ADCF == 0);
            ADCF = 0;
        #else                                   //Interrupt
            EADC = 1;
            EA = 1;
            set_IDLE;                           //Enter idle mode
        #endif
        printf ("\n*  ADC conver value = %d",(UINT16)ADCRH);
        Timer0_Delay1ms(100);
    }
}

使用特权

评论回复
6
643757107| | 2017-6-26 18:43 | 只看该作者
例程序也是丰富多彩,ADC几乎每个通道都有了。

使用特权

评论回复
7
langziwuliao| | 2017-6-28 14:12 | 只看该作者
讲的好,鼓掌  

使用特权

评论回复
8
天灵灵地灵灵| | 2017-6-29 10:07 | 只看该作者
将的太好了,这个LCD用于小电器给力啊。

使用特权

评论回复
9
小灵通2018| | 2018-11-6 17:22 | 只看该作者
LCD的驱动有点难。

使用特权

评论回复
10
yiy| | 2018-11-8 16:24 | 只看该作者
没看懂啊,官方应该给个库函数的。

使用特权

评论回复
11
yiyigirl2014| | 2018-11-12 19:53 | 只看该作者
之前以为LCD驱动跟LED是一样的呢,后来才发现不是那样

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

115

主题

1700

帖子

1

粉丝