ABOV 第一节 ABOV 程序生成器的使用 2021-11-11

ABOV 程序

第一节 ABOV 程序生成器的使用


在这里插入图片描述
ABOV官网


前言

韩国现代单片机是 “以顾客为中心挑战与创新” 经营理念为基础, 在2006年2月从Magnachip半导体(旧:海力士)公司独立出来的专业半导体公司,现代单片机以MCU(微控制器)技术为基础,融合 Sensor和 Connectivity解决方案,在5G时代到来之际与AI(人工智能)和IOT技术创新一起,引领着数字化时代。
在这里插入图片描述
在这里插入图片描述


提示:以下是本篇文章正文内容,下面案例可供参考

一、ABOV是什么?

ABOV半导体在2006年自韩国HYNIX分离出来,有超过20年单片机领域耕耘经验。ABOV半导体有单片机和标准IC另类产品

二、使用步骤

1.选择需要用到的IC资料

ABOV MC95FG308数据手册

原理图如下:

在这里插入图片描述
安装低版本的KEIL软件,因为ABOV关联的版本低
在这里插入图片描述

2.利用软件初步生产IC配置文件

阿萨德图片描述
软件链接 : OCD2_debugger_V2.031

步骤如下(示例):
1. 选择芯片类型
2. 选择相关芯片
3. 选择引脚脚位数量

在这里插入图片描述

3.利用软件初步生产代码文件

步骤如下(示例):
1. 选择芯片的图
2. 配置相关芯片脚位
3. 首先配置USAR1 引脚输入输出状态
4. 配置IC 晶振需要配置
5. 配置输入输出口
6. 配置AD口
7. 选项卡选择定时器的参数 有时间使能定时时间大小
8. 选项卡选择AD的参数 有使能 数据中断 数据对其方式
9. 选项卡选择USAR的参数 有使能 波特率 中断方式

ABOV 芯片配置方法

-- 最后记得将IC晶振外置进行勾选。

在这里插入图片描述

4.利用软件初步生产代码文件

步骤如下(示例):
1. 选择File进行芯片程序更新

ABOV 芯片配置方法

//======================================================
// Main program routine
// - Device name  : MC95FG308
// - Package type : 28SOP
//======================================================
// For XDATA variable : V1.041.00 ~
#define		MAIN	1

// Generated    : Fri, Nov 12, 2021 (15:16:38)
#include	"MC95FG308.h"
#include	"func_def.h"

void main()
{
    
    
	cli();          	// disable INT. during peripheral setting
	port_init();    	// initialize ports
	clock_init();   	// initialize operation clock
	ADC_init();     	// initialize A/D convertor
	Timer0_init();  	// initialize Timer0
	UART_init();    	// initialize UART interface
	sei();          	// enable INT.
	
	// TODO: add your main code here
	
	while(1);
}

//======================================================
// interrupt routines
//======================================================

void INT_USART0_Rx() interrupt 6
{
    
    
	// USART0 Rx interrupt
	// TODO: add your code here
}

void INT_USART1_Rx() interrupt 10
{
    
    
	// USART1 Rx interrupt
	// TODO: add your code here
}

void INT_Timer0() interrupt 12
{
    
    
	// Timer0 interrupt
	// TODO: add your code here
}

void INT_ADC() interrupt 18
{
    
    
	// ADC interrupt
	// TODO: add your code here
}

//======================================================
// peripheral setting routines
//======================================================

unsigned char UART_read(unsigned char ch)
{
    
    
	unsigned char dat;
	
	if (ch == (unsigned char)0) {
    
    	// UART0
		while(!(USTAT & 0x20));	// wait
		dat = UDATA;   	// read
	}
	if (ch == (unsigned char)1) {
    
    	// UART1
		while(!(USTAT1 & 0x20));	// wait
		dat = UDATA1;  	// read
	}
	return	dat;
}

unsigned int ADC_read()
{
    
    
	// read A/D convertor
	unsigned int adcVal;
	
	while(!(ADCM & 0x10));	// wait ADC busy
	adcVal = (ADCRH << 8) | ADCRL;	// read ADC
	ADCM &= ~0x40;  	// stop ADC
	return	adcVal;
}

void ADC_init()
{
    
    
	// initialize A/D convertor
	ADCM = 0x00;    	// setting
	ADCM2 = 0x04;   	// trigger source, alignment, frequency
	IEN3 |= 0x01;   	// enable ADC interrupt
}

void ADC_start(unsigned char ch)
{
    
    
	// start A/D convertor
	ADCM = (ADCM & 0xf0) | (ch & 0xf);	// select channel
	ADCM |= 0x40;   	// start ADC
}

void Timer0_init()
{
    
    
	// initialize Timer0
	// 8bit timer, period = 9.984000mS
	T0CR = 0x9A;    	// timer setting
	T0DR = 0x26;    	// period count
	IEN2 |= 0x01;   	// Enable Timer0 interrupt
	T0CR |= 0x01;   	// clear counter
}

void UART_init()
{
    
    
	// initialize UART interface
	// UART0 : ASync. 9615bps N 8 1
	UCTRL2 = 0x02;  	// activate UART0
	UCTRL1 = 0x06;  	// Async/Sync, bit count, parity
	UCTRL2 |= 0xAC; 	// interrupt, speed
	//UCTRL2 |= 0x10;	// enable line when you want to use wake up in STOP mode
	UCTRL3 = 0x00;  	// stop bit
	UBAUD = 0x33;   	// baud rate

	// UART1 : ASync. 9615bps N 8 1
	UCTRL12 = 0x02; 	// activate UART1
	UCTRL11 = 0x06; 	// Async/Sync, bit count, parity
	UCTRL12 |= 0xAC;	// interrupt, speed
	//UCTRL12 |= 0x10;	// enable line when you want to use wake up in STOP mode
	UCTRL13 = 0x00; 	// stop bit
	UBAUD1 = 0x33;  	// baud rate

	IEN1 |= 0x11;   	// enable UART interrupt
}

void UART_write(unsigned char ch, unsigned char dat)
{
    
    
	if (ch == (unsigned char)0) {
    
    	// UART0
		while(!(USTAT & 0x80));	// wait
		UDATA = dat;   	// write
	}
	if (ch == (unsigned char)1) {
    
    	// UART1
		while(!(USTAT1 & 0x80));	// wait
		UDATA1 = dat;  	// write
	}
}

void clock_init()
{
    
    
	// internal RC clock (8.000000MHz)
	// Nothing to do for the default clock
}

void port_init()
{
    
    
	// initialize ports
	//   3 : AN4      in  
	//   9 : P11      out 
	//  10 : P12      out 
	//  16 : TxD1     out 
	//  17 : RxD1     in  
	//  19 : XIN      in  
	//  20 : XOUT     out 
	//  25 : TxD0     out 
	//  26 : RxD0     in  
	P0IO = 0xE7;    	// direction
	P0PU = 0x08;    	// pullup
	P0OD = 0x00;    	// open drain
	P0DB = 0x00;    	// debounce
	P0   = 0x00;    	// port initial value

	P1IO = 0xFF;    	// direction
	P1PU = 0x00;    	// pullup
	P1OD = 0x00;    	// open drain
	P1DB = 0x00;    	// debounce
	P1   = 0x00;    	// port initial value

	P2IO = 0xFE;    	// direction
	P2PU = 0x00;    	// pullup
	P2OD = 0x00;    	// open drain
	P2DB = 0x00;    	// debounce
	P2   = 0x00;    	// port initial value

	P3IO = 0x7F;    	// direction
	P3PU = 0x80;    	// pullup
	P3OD = 0x00;    	// open drain
	P3DB = 0x00;    	// debounce
	P3   = 0x00;    	// port initial value

	// Set port function
	PSR0 = 0x10;    	// AN7 ~ AN0
	PSR1 = 0x00;    	// I2C, AN14 ~ AN8
}

5.利用软件对生产的代码进行仿真

1.开发环境:官方推出的IDE有Keil和IAR两种,但是官网上所给出的代码例程绝大数都是Keil为例,所有强烈推荐Keil C51作为你的首选开发环境

2.仿真工具:开发环境Keil C51 连接官方的USB OCD-II仿真工具可以实现代码的实时仿真,仿真板Target需要4根线连接到USB OCD-II,分别是VCC、GND、SDA、SCL,注意仿真器不带有电源,所以需要单独给仿真板子供电,注意数据线和时钟线是ABOV单片机的特定引脚的专用接口,并非通常的IIC接口,这点需要特别注意。仿真工具USB OCD-II的驱动安装最新文件可以在官网进行下载 ,一般仿真器的驱动在安装文件夹里

在这里插入图片描述
OCD2仿真软件下载

步骤如下(示例):
1. 建立代码生成器与KEIL直接的关系
2. 建立自己的代码并进行编译
3. 打开仿真软件 -> 插入仿真器与电脑口-> 选择8MS 的芯片类型--> 点击 仿真 -> 打开HEX文件-> 选择外部晶振和禁止

ABOV 代码编辑与仿真软件使用


实现结果展示

总结

以上就是今天的内容,本文介绍了ABOV的使用,关于代码生成器的使用以及芯片配置的注意问题

Guess you like

Origin blog.csdn.net/u012651389/article/details/121274839