This commit is contained in:
sunbeam 2025-01-17 15:39:34 +08:00
commit 9f790521fa
71 changed files with 19170 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
DefaultBuild
SmartManual Docs
*.mtud

20
bl_fc/.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"__near="
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}

9
bl_fc/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,9 @@
{
"files.associations": {
"event.h": "c",
"apptask.h": "c",
"hwctrl.h": "c",
"r_cg_macrodriver.h": "c",
"iodefine.h": "c"
}
}

View File

@ -0,0 +1,294 @@
QualityReport
2023年11月6日 8:50:02
------ Start build(bl, DefaultBuild) ------
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_cgc_user.c -cpu=S2 -o DefaultBuild\r_cg_cgc_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_systeminit.c -cpu=S2 -o DefaultBuild\r_systeminit.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_port_user.c -cpu=S2 -o DefaultBuild\r_cg_port_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe hwCtrl.c -cpu=S2 -o DefaultBuild\hwCtrl.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe appTask.c -cpu=S2 -o DefaultBuild\appTask.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_adc_user.c -cpu=S2 -o DefaultBuild\r_cg_adc_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_timer_user.c -cpu=S2 -o DefaultBuild\r_cg_timer_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_wdt_user.c -cpu=S2 -o DefaultBuild\r_cg_wdt_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_port.c -cpu=S2 -o DefaultBuild\r_cg_port.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_timer.c -cpu=S2 -o DefaultBuild\r_cg_timer.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_adc.c -cpu=S2 -o DefaultBuild\r_cg_adc.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
hwCtrl.c(64):W0520111:Statement is unreachable
hwCtrl.c(67):W0520111:Statement is unreachable
hwCtrl.c(70):W0520111:Statement is unreachable
hwCtrl.c(73):W0520111:Statement is unreachable
hwCtrl.c(78):W0520111:Statement is unreachable
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_main.c -cpu=S2 -o DefaultBuild\r_main.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_cgc.c -cpu=S2 -o DefaultBuild\r_cg_cgc.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_wdt.c -cpu=S2 -o DefaultBuild\r_cg_wdt.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
appTask.c(41):W0523077:Called function should have prototype
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe cstart.asm -cpu=S2 -o DefaultBuild\cstart.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe stkinit.asm -cpu=S2 -o DefaultBuild\stkinit.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe event.c -cpu=S2 -o DefaultBuild\event.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
appTask.c(42):W0523077:Called function should have prototype
appTask.c(263):W0520177:Variable "ledno" was declared but never referenced
appTask.c(263):W0520177:Variable "last" was declared but never referenced
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\rlink.exe -subcommand=DefaultBuild\bl.clnk
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
Renesas Optimizing Linker Completed
------ Build ended(Error:0, Warning:11)(bl, DefaultBuild) ------
--- CommandFile 1 ---
DefaultBuild\bl.clnk :
-Input=DefaultBuild\cstart.obj
-Input=DefaultBuild\stkinit.obj
-Input=DefaultBuild\r_main.obj
-Input=DefaultBuild\r_systeminit.obj
-Input=DefaultBuild\r_cg_cgc.obj
-Input=DefaultBuild\r_cg_cgc_user.obj
-Input=DefaultBuild\r_cg_port.obj
-Input=DefaultBuild\r_cg_port_user.obj
-Input=DefaultBuild\r_cg_adc.obj
-Input=DefaultBuild\r_cg_adc_user.obj
-Input=DefaultBuild\r_cg_timer.obj
-Input=DefaultBuild\r_cg_timer_user.obj
-Input=DefaultBuild\r_cg_wdt.obj
-Input=DefaultBuild\r_cg_wdt_user.obj
-Input=DefaultBuild\appTask.obj
-Input=DefaultBuild\event.obj
-Input=DefaultBuild\hwCtrl.obj
-SECURITY_ID=00000000000000000000
-DEVICE=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF
-DEBug
-NOCOmpress
-NOOPtimize
-OUtput=DefaultBuild\bl.abs
-LIBrary=E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\lib\rl78cm4s.lib
-LIBrary=E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\lib\malloc_n.lib
-LIBrary=E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\lib\rl78cm4r.lib
-OCDBG=84
-DEBUG_MONITOR=1E00-1FFF
-USER_OPT_BYTE=FB33E0
-LISt=DefaultBuild\bl.map
-AUTO_SECTION_LAYOUT
-ROm=.data=.dataR
-ROm=.sdata=.sdataR
-NOMessage
-MEMory=High
-NOLOgo
-end
-Input=DefaultBuild\bl.abs
-DEVICE=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF
-OUtput=DefaultBuild\bl.mot
-FOrm=Stype
-NOMessage
-exit
--- SHA1 hash value of output files ---
F:\FCB_project\temp\blsz\bl_fc\DefaultBuild\bl.abs: 4b447ce85a04f7a0c7d4992562e176b47913116b
F:\FCB_project\temp\blsz\bl_fc\DefaultBuild\bl.mot: 6a514eebfa9d190eea46e5d62a619e4ebc65a9dd
--- System Information ---
*OS Version
Microsoft Windows 10 专业版 (-, 10.0.19045, WOW64)
*Language
中文(中国)
*.NET Framework Version
Microsoft .NET Framework 4 [.NET 4.6 or later] (4.0.30319.42000)
--- Application Information ---
*Product Name
CS+ for CC
*Package Version
V8.07.00 [01 Dec 2021]
*Version
V9.07.00.06 [15 Nov 2021]
*Assembly Version
3.12.10.1
*Sales Area
Japan
*Product License
*Execution Place
E:\Program Files (x86)\renesas\CS+\CC
*Memory Usage
*Private Working Set
274 MB
*Number of GDI Objects
1947
*Number of USER Objects
1087
*Opened Files
2 editors, 2 files, 11 KB
--- Build Tool Plug-in Information ---
RH850 Build tool CC-RH Plug-in
*Version
V8.02.00.00 [25 Mar 2019]
*Assembly Version
1.1.10.12
*DLL File Name
BuildToolCCRH.dll
RL78 Build tool CC-RL Plug-in
*Version
V8.05.00.00 [08 Oct 2020]
*Assembly Version
1.0.0.0
*DLL File Name
BuildToolCCRL.dll
RX Build tool CC-RX Plug-in
*Version
V8.02.00.00 [25 Mar 2019]
*Assembly Version
3.12.10.1
*DLL File Name
BuildToolCCRX.dll
RH850 Build tool GHS CCRH850 Plug-in
*Version
V1.05.00.00 [08 Oct 2020]
*Assembly Version
1.0.0.0
*DLL File Name
BuildToolGHSCCRH850.dll
--- Debug Tool Plug-in Information ---
Debugger Collection Plug-in
*Version
V8.07.00.05 [01 Dec 2021]
*Assembly Version
2.12.10.1
*DLL File Name
DebugToolCollection.dll
--- Other Plug-in Information ---
Code Generator Plug-in
*Version
V4.08.05.01 [14 Aug 2020]
*Assembly Version
3.0.0.0
*DLL File Name
CodePart.dll
Code Generator/PinView Plug-in
*Version
V2.10.07.02 [08 Nov 2021]
*Assembly Version
1.0.0.0
*DLL File Name
CodePart2.dll
Debug Console Plug-in
*Version
V7.00.00.01 [06 Apr 2018]
*Assembly Version
7.0.0.0
*DLL File Name
DebugConsole.dll
Quick and Effective tool solution - QE
*Version
V9.06.00.04 [25 May 2021]
*Assembly Version
1.15.10.16
*DLL File Name
InCarTools.dll
Pin Configurator Plug-in
*Version
V1.54.01.01 [31 Jul 2014]
*Assembly Version
1.6.10.23
*DLL File Name
PinConfig.dll
Program Analyzer Plug-in
*Version
V4.12.00.01 [14 Apr 2021]
*Assembly Version
3.12.11.9
*DLL File Name
ProgramAnalyzer.dll
IronPython Console Plug-in
*Version
V1.43.00.02 [29 Oct 2021]
*Assembly Version
1.6.10.23
*DLL File Name
PythonConsole.dll
Editor plug-in DLL
*Version
V1.17.00.01 [15 Oct 2020]
*Assembly Version
1.1.0.0
*DLL File Name
SEditor.dll
Stack Usage Tracer
*Version
V1.05.00.02 [30 Jul 2014]
*Assembly Version
1.30.11.15
*DLL File Name
Stk.dll
Update Manager Plug-in
*Version
V2.03.00.02 [29 Oct 2018]
*Assembly Version
1.13.6.20
*DLL File Name
Update.dll
Debug Tool Common Interface
*Version
V8.07.00.05 [01 Dec 2021]
*Assembly Version
3.12.10.1
*DLL File Name
CommonDebuggerInterface.dll
Device Information Common Interface
*Version
V9.07.00.01 [14 Oct 2021]
*Assembly Version
3.0.0.0
*DLL File Name
DeviceInformation.dll
--- Main Project Information ---
F:\FCB_project\temp\blsz\bl_fc\bl.mtpj
Microcontroller Information
*R5F10268
*File Name: Version
RL78_Productlist.xml: V8.070000
R5F10268_common.xml: V1.10.00.XX.01
DR5F10268.DVF: V1.12
g12_26xasp_flash.ti: V1.00
-: -
Build Tool Information
*CC-RL
* Version of plug-in(*.dll)
V8.07.00.03 [11 Nov 2021]
* The Version of the Compiler Package
V1.11.00
* The version of SMS Assembler
V1.00.00.01 [29 May 2020]
Debug Tool Information
*RL78 EZ Emulator
Debugger Library V8.07.00.05 [01 Dec 2021]
Other Tool Information
*None
*None
*Pin Configurator
*Program Analyzer
*Version
V4.12.00.01 [14 Apr 2021]
*Code Generator
Other Information
*RL78/G12 Code Library
*Version
V2.04.06.02 [08 Nov 2021]
*Description
Code library for RL78/G12 code generation plugin.

299
bl_fc/appTask.c Normal file
View File

@ -0,0 +1,299 @@
#include "r_cg_macrodriver.h"
#include "appTask.h"
#include "event.h"
#include "r_cg_port.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
#include "hwCtrl.h"
void KeyPressPro(uint8_t keyno);
void KeyReleasePro(uint8_t keyno);
static uint8_t autoflag = 0;
static uint8_t updown = 0,stopflag = 0;
static uint16_t keydelay[5]={0,0,0,0,0};
static uint8_t keyflag[5]={0,0,0,0,0};
static uint8_t shoudong = 0;
#define UPDOWN_UP 1
#define UPDOWN_DOWN 2
#define UPDOWN_NO 0
#define KEY_DELAY_TIME 6
#define KEY_DELAY_TIME_50ms 10
#define KEY_DELAY_TIME_8000ms 1600
uint8_t shortflag;
void HardWare_Init(void)
{
//time base init
R_TAU0_Channel0_Start();
//output init
RLY1_Ctrl(OFF);
RLY2_Ctrl(OFF);
MOS_Ctrl(OFF);
//adc init
R_ADC_Start();
R_ADC_Set_OperationOn();
R_TAU0_Channel1_Start();//for adc scan
}
void Variable_Init(void)
{
autoflag = 0;
updown = 0;
shortflag = 1;
}
void KeyPressPro(uint8_t keyno)
{
if(autoflag != UPDOWN_NO)
{
autoflag = 0;
shoudong = keyno+1;
return;
}
if (keyno == KEY_UP || keyno == KEY_L_UP)
{
updown = UPDOWN_UP;
}
else if (keyno == KEY_DOWN || keyno == KEY_L_DOWN)
{
updown = UPDOWN_DOWN;
}
}
void KeyReleasePro(uint8_t keyno)
{
if (keyno+1 == shoudong)
{
shoudong = 0;
return;
}
switch (keyno)
{
case KEY_UP:
//NO
break;
case KEY_DOWN:
if (keydelay[KEY_AUTO]>=KEY_DELAY_TIME_50ms && keydelay[KEY_AUTO] < KEY_DELAY_TIME_8000ms && shortflag == 0)
{
autoflag = UPDOWN_DOWN;
}
break;
default:
break;
}
}
void keyScan(void)//5ms
{
uint8_t i;
for (i = 0; i < 4; i++)
{
if (GetKeyState(i) == KEY_PRESSED)
{
keydelay[i]++;
if (keydelay[i] > KEY_DELAY_TIME)
{
keydelay[i] = KEY_DELAY_TIME;
if (keyflag[i] == 0)
{
keyflag[i] = 1;
KeyPressPro(i);
}
}
}
else
{
if (keydelay[i] > 0)
{
keydelay[i]--;
if (keydelay[i] == 0 && keyflag[i] == 1)//减到0且按下过
{
keyflag[i] = 0;
KeyReleasePro(i);
}
}
}
}
if (keyflag[KEY_UP] == 0 && keyflag[KEY_DOWN] == 0 && keyflag[KEY_L_UP] == 0 && keyflag[KEY_L_DOWN] == 0)
{
updown = 0;
stopflag = 0;
shoudong = 0;
shortflag = 0;
}
if (GetKeyState(KEY_AUTO) == KEY_PRESSED)
{
keydelay[KEY_AUTO]++;
if (keydelay[KEY_AUTO] >= 2000)
{
keydelay[KEY_AUTO] = 2000;
}
}
else
{
if (keyflag[KEY_UP]==0 && keyflag[KEY_DOWN]==0)
{
keydelay[KEY_AUTO] = 0;
}
}
}
#define MOTOR_NONE 0
#define MOTOR_UP 1
#define MOTOR_DOWN 2
#define MOTOR_BREAK 3
void Motor_Ctrl(uint8_t state)
{
switch (state)
{
case MOTOR_UP:
RLY2_Ctrl(ON);
RLY1_Ctrl(OFF);
MOS_Ctrl(ON);
break;
case MOTOR_DOWN:
RLY2_Ctrl(OFF);
RLY1_Ctrl(ON);
MOS_Ctrl(ON);
break;
case MOTOR_BREAK:
RLY1_Ctrl(ON);
RLY2_Ctrl(ON);
MOS_Ctrl(ON);
break;
default:
RLY1_Ctrl(OFF);
RLY2_Ctrl(OFF);
MOS_Ctrl(OFF);
break;
}
}
#define OC_9A 21
#define OC_13A 30
#define OC_6A 12
extern uint16_t g_adcval;
void Output_Ctrl(void)//10mS
{
static uint16_t autotime=0;
static uint8_t oc_delay = 0;
if (g_adcval > OC_9A)
{
oc_delay++;
if (oc_delay > 20)//200 ms
{
Motor_Ctrl(MOTOR_NONE);
shortflag = 1;
}
}
else
{
oc_delay = 0;
}
if (shortflag == 1)
{
autoflag = 0;
Motor_Ctrl(MOTOR_NONE);
return;
}
if (stopflag == 1)
{
Motor_Ctrl(MOTOR_NONE);
return;
}
if (updown == UPDOWN_UP)
{
Motor_Ctrl(MOTOR_UP);
autotime++;
}
else if (updown == UPDOWN_DOWN)
{
Motor_Ctrl(MOTOR_DOWN);
autotime++;
}
else
{
if (autoflag == UPDOWN_DOWN)
{
Motor_Ctrl(MOTOR_DOWN);
autotime++;
}
else
{
Motor_Ctrl(MOTOR_NONE);
autotime = 0;
}
}
if (autotime > 800)//8s
{
Motor_Ctrl(MOTOR_NONE);
autotime = 0;
autoflag = 0;
stopflag = 1;
}
}
void AppTask(void)
{
static uint8_t ledno = 1,last = 0;
if (TimeBase5msFlag == 1)
{
TimeBase5msFlag = 0;
keyScan();
}
if (TimeBase10msFlag == 1)
{
TimeBase10msFlag = 0;
Output_Ctrl();
}
if (TimeBase100msFlag == 1)
{
TimeBase100msFlag = 0;
R_WDT_Restart();
}
if (TimeBase1000msFlag == 1)
{
TimeBase1000msFlag = 0;
/*
LED_Ctrl1LED(ledno,LED_ON);
LED_Ctrl1LED(last,LED_OFF);
last = ledno;
ledno++;
if (ledno > 9)
{
ledno = 1;
}
*/
}
}

9
bl_fc/appTask.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __APPTASK_H__
#define __APPTASK_H__
void HardWare_Init(void);
void Variable_Init(void);
void AppTask(void);
#endif

4569
bl_fc/bl.mtpj Normal file

File diff suppressed because it is too large Load Diff

1282
bl_fc/bl.rcpe Normal file

File diff suppressed because it is too large Load Diff

229
bl_fc/cstart.asm Normal file
View File

@ -0,0 +1,229 @@
;/**********************************************************************************************************************
; * DISCLAIMER
; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
; * applicable laws, including copyright laws.
; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO
; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
; * this software. By using this software, you agree to the additional terms and conditions found by accessing the
; * following link:
; * http://www.renesas.com/disclaimer
; *
; * Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
; *********************************************************************************************************************/
; NOTE : THIS IS A TYPICAL EXAMPLE.
$IFNDEF __RENESAS_VERSION__
__RENESAS_VERSION__ .EQU 0x01000000
$ENDIF
.public _start
.public _exit
;-----------------------------------------------------------------------------
; RAM section
;-----------------------------------------------------------------------------
.SECTION .dataR, DATA
.SECTION .sdataR, DATA
; .SECTION .datafR, DATAF
; .SECTION .textfR, TEXTF
$IF (__RENESAS_VERSION__ < 0x01010000) ; for CC-RL V1.00
;-----------------------------------------------------------------------------
; stack area
;-----------------------------------------------------------------------------
; !!! [CAUTION] !!!
; Set up stack size suitable for a project.
.SECTION .stack_bss, BSS
_stackend:
.DS 0x200
_stacktop:
$ENDIF
;-----------------------------------------------------------------------------
; RESET vector
;-----------------------------------------------------------------------------
_start .VECTOR 0
;-----------------------------------------------------------------------------
; startup
;-----------------------------------------------------------------------------
.SECTION .text, TEXT
_start:
;--------------------------------------------------
; setting register bank
;--------------------------------------------------
; SEL RB0
;--------------------------------------------------
; setting mirror area
;--------------------------------------------------
; ONEB !PMC ; mirror area = 10000-1FFFFH
;--------------------------------------------------
; setting the stack pointer
;--------------------------------------------------
$IF (__RENESAS_VERSION__ >= 0x01010000)
MOVW SP,#LOWW(__STACK_ADDR_START)
$ELSE ; for CC-RL V1.00
MOVW SP,#LOWW(_stacktop)
$ENDIF
;--------------------------------------------------
; initializing stack area
;--------------------------------------------------
$IF (__RENESAS_VERSION__ >= 0x01010000)
MOVW AX,#LOWW(__STACK_ADDR_END)
$ELSE ; for CC-RL V1.00
MOVW AX,#LOWW(_stackend)
$ENDIF
CALL !!_stkinit
;--------------------------------------------------
; hardware initialization
;--------------------------------------------------
CALL !!_hdwinit
;--------------------------------------------------
; initializing BSS
;--------------------------------------------------
; clear external variables which doesn't have initial value (near)
MOVW HL,#LOWW(STARTOF(.bss))
MOVW AX,#LOWW(STARTOF(.bss) + SIZEOF(.bss))
BR $.L2_BSS
.L1_BSS:
MOV [HL+0],#0
INCW HL
.L2_BSS:
CMPW AX,HL
BNZ $.L1_BSS
; clear saddr variables which doesn't have initial value
MOVW HL,#LOWW(STARTOF(.sbss))
MOVW AX,#LOWW(STARTOF(.sbss) + SIZEOF(.sbss))
BR $.L2_SBSS
.L1_SBSS:
MOV [HL+0],#0
INCW HL
.L2_SBSS:
CMPW AX,HL
BNZ $.L1_SBSS
; clear external variables which doesn't have initial value (far)
; MOV ES,#HIGHW(STARTOF(.bssf))
; MOVW HL,#LOWW(STARTOF(.bssf))
; MOVW AX,#LOWW(STARTOF(.bssf) + SIZEOF(.bssf))
; BR $.L2_BSSF
;.L1_BSSF:
; MOV ES:[HL+0],#0
; INCW HL
;.L2_BSSF:
; CMPW AX,HL
; BNZ $.L1_BSSF
;--------------------------------------------------
; ROM data copy
;--------------------------------------------------
; copy external variables having initial value (near)
MOV ES,#HIGHW(STARTOF(.data))
MOVW BC,#LOWW(SIZEOF(.data))
BR $.L2_DATA
.L1_DATA:
DECW BC
MOV A,ES:LOWW(STARTOF(.data))[BC]
MOV LOWW(STARTOF(.dataR))[BC],A
.L2_DATA:
CLRW AX
CMPW AX,BC
BNZ $.L1_DATA
; copy saddr variables having initial value
MOV ES,#HIGHW(STARTOF(.sdata))
MOVW BC,#LOWW(SIZEOF(.sdata))
BR $.L2_SDATA
.L1_SDATA:
DECW BC
MOV A,ES:LOWW(STARTOF(.sdata))[BC]
MOV LOWW(STARTOF(.sdataR))[BC],A
.L2_SDATA:
CLRW AX
CMPW AX,BC
BNZ $.L1_SDATA
; copy external variables having initial value (far)
; MOVW BC,#LOWW(SIZEOF(.dataf))
; BR $.L2_DATAF
;.L1_DATAF:
; DECW BC
; MOV ES,#HIGHW(STARTOF(.dataf))
; MOV A,ES:LOWW(STARTOF(.dataf))[BC]
; MOV ES,#HIGHW(STARTOF(.datafR))
; MOV ES:LOWW(STARTOF(.datafR))[BC],A
;.L2_DATAF:
; CLRW AX
; CMPW AX,BC
; BNZ $.L1_DATAF
; copy .text to RAM
; MOV C,#HIGHW(STARTOF(.textf))
; MOVW HL,#LOWW(STARTOF(.textf))
; MOVW DE,#LOWW(STARTOF(.textfR))
; BR $.L2_TEXT
;.L1_TEXT:
; MOV A,C
; MOV ES,A
; MOV A,ES:[HL]
; MOV [DE],A
; INCW DE
; INCW HL
; CLRW AX
; CMPW AX,HL
; SKNZ
; INC C
;.L2_TEXT:
; MOVW AX,HL
; CMPW AX,#LOWW(STARTOF(.text) + SIZEOF(.text))
; BNZ $.L1_TEXT
;--------------------------------------------------
; call main function
;--------------------------------------------------
CALL !!_main ; main();
;--------------------------------------------------
; call exit function
;--------------------------------------------------
CLRW AX ; exit(0)
_exit:
BR $_exit
;-----------------------------------------------------------------------------
; section
;-----------------------------------------------------------------------------
$IF (__RENESAS_VERSION__ >= 0x01010000)
.SECTION .RLIB, TEXTF
.L_section_RLIB:
.SECTION .SLIB, TEXTF
.L_section_SLIB:
$ENDIF
.SECTION .textf, TEXTF
.L_section_textf:
.SECTION .constf, CONSTF
.L_section_constf:
.SECTION .data, DATA
.L_section_data:
;.SECTION .dataf, DATAF
;.L_section_dataf:
.SECTION .sdata, SDATA
.L_section_sdata:
.SECTION .bss, BSS
.L_section_bss:
;.SECTION .bssf, BSSF
;.L_section_bssf:
.SECTION .sbss, SBSS
.L_section_sbss:

46
bl_fc/event.c Normal file
View File

@ -0,0 +1,46 @@
#include "event.h"
static volatile uint16_t TimeBaseCounter;
volatile uint8_t TimeBase1msFlag;
volatile uint8_t TimeBase5msFlag;
volatile uint8_t TimeBase10msFlag;
volatile uint8_t TimeBase20msFlag;
volatile uint8_t TimeBase50msFlag;
volatile uint8_t TimeBase100msFlag;
volatile uint8_t TimeBase1000msFlag;
void TimeBaseCount(void)
{
TimeBaseCounter++;
TimeBase1msFlag = 1;
if(TimeBaseCounter % 5 == 0)
{
TimeBase5msFlag = 1;
}
if(TimeBaseCounter % 10 == 0)
{
TimeBase10msFlag = 1;
}
if(TimeBaseCounter % 20 == 0)
{
TimeBase20msFlag = 1;
}
if(TimeBaseCounter % 50 == 0)
{
TimeBase50msFlag = 1;
}
if(TimeBaseCounter % 100 == 0)
{
TimeBase100msFlag = 1;
}
if(TimeBaseCounter % 1000 == 0)
{
TimeBase1000msFlag = 1;
}
if(TimeBaseCounter >= 60000)
{
TimeBaseCounter = 0;
}
}

18
bl_fc/event.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef __EVENT_H__
#define __EVENT_H__
#include "r_cg_macrodriver.h"
extern volatile uint8_t TimeBase1msFlag;
extern volatile uint8_t TimeBase5msFlag;
extern volatile uint8_t TimeBase10msFlag;
extern volatile uint8_t TimeBase20msFlag;
extern volatile uint8_t TimeBase50msFlag;
extern volatile uint8_t TimeBase100msFlag;
extern volatile uint8_t TimeBase1000msFlag;
extern void TimeBaseCount(void);
#endif

35
bl_fc/hdwinit.asm Normal file
View File

@ -0,0 +1,35 @@
;/**********************************************************************************************************************
; * DISCLAIMER
; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
; * applicable laws, including copyright laws.
; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO
; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
; * this software. By using this software, you agree to the additional terms and conditions found by accessing the
; * following link:
; * http://www.renesas.com/disclaimer
; *
; * Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
; *********************************************************************************************************************/;---------------------------------------------------------------------
; _hdwinit
;
; void _hdwinit(void);
;
; input:
; NONE
; output:
; NONE
;---------------------------------------------------------------------
; NOTE : THIS IS A TYPICAL EXAMPLE.
.PUBLIC _hdwinit
.textf .CSEG TEXTF
_hdwinit:
RET

80
bl_fc/hwCtrl.c Normal file
View File

@ -0,0 +1,80 @@
#include "hwCtrl.h"
#include "r_cg_port.h"
#include "iodefine.h"
#define IO_KEYUP P2_bit.no0
#define IO_KEYDOWN P1_bit.no2
#define IO_KEYAUTO P1_bit.no4
#define IO_L_KEYUP P4_bit.no2
#define IO_L_KEYDOWN P2_bit.no1
#define IO_OUT1 P2_bit.no2
#define IO_OUT2 P1_bit.no1
#define IO_MOS P1_bit.no0
void RLY1_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_OUT1 = 1;
}
else
{
IO_OUT1 = 0;
}
}
void RLY2_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_OUT2 = 1;
}
else
{
IO_OUT2 = 0;
}
}
void MOS_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_MOS = 1;
}
else
{
IO_MOS = 0;
}
}
uint8_t GetKeyState(uint8_t keyno)
{
switch (keyno)
{
case KEY_UP:
return IO_KEYUP;
break;
case KEY_DOWN:
return IO_KEYDOWN;
break;
case KEY_L_UP:
return IO_L_KEYUP;
break;
case KEY_L_DOWN:
return IO_L_KEYDOWN;
break;
case KEY_AUTO:
return IO_KEYAUTO;
default:
return 0;
break;
}
}

24
bl_fc/hwCtrl.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef __HWCTRL_H__
#define __HWCTRL_H__
#include "r_cg_macrodriver.h"
#define KEY_UP 0
#define KEY_DOWN 1
#define KEY_L_UP 2
#define KEY_L_DOWN 3
#define KEY_AUTO 4
#define ON 1
#define OFF 0
#define KEY_PRESSED 1
#define KEY_NOTPRESSES 0
uint8_t GetKeyState(uint8_t keyno);
void RLY1_Ctrl(uint8_t onoff);
void RLY2_Ctrl(uint8_t onoff);
void MOS_Ctrl(uint8_t onoff);
#endif

542
bl_fc/iodefine.h Normal file
View File

@ -0,0 +1,542 @@
/******************************************************************************/
/* DISCLAIMER */
/* This software is supplied by Renesas Electronics Corporation and is only */
/* intended for use with Renesas products. No other uses are authorized.This */
/* software is owned by Renesas Electronics Corporation and is protected */
/* under all applicable laws, including copyright laws. */
/* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES */
/* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING */
/* BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR */
/* PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY */
/* DISCLAIMED. */
/* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS */
/* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE */
/* LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL */
/* DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS */
/* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */
/* Renesas reserves the right, without notice, to make changes to this */
/* software and to discontinue the availability of this software. */
/* By using this software, you agree to the additional terms and conditions */
/* found by accessing the following link: */
/* http://www.renesas.com/disclaimer */
/* */
/* Device : RL78/R5F10268 */
/* File Name : iodefine.h */
/* Abstract : Definition of Special Function Register (SFR) */
/* History : V1.12 [Device File version] */
/* Options : -df=C:\Program Files (x86)\Renesas Electronics\CS+\CC\Device\ */
/* RL78\Devicefile\DR5F10268.DVF -o=F:\FCBproject\temp\bl\iodefi */
/* ne.h -f */
/* Date : 2022/4/28 */
/* Version : V1.15.00.01 [df2iodef.exe version] */
/* This is a typical example. */
/* */
/******************************************************************************/
#ifndef __R5F10268IODEFINE_HEADER__
#define __R5F10268IODEFINE_HEADER__
typedef struct
{
unsigned char no0:1;
unsigned char no1:1;
unsigned char no2:1;
unsigned char no3:1;
unsigned char no4:1;
unsigned char no5:1;
unsigned char no6:1;
unsigned char no7:1;
} __bitf_T;
typedef struct
{
unsigned char no0:1;
unsigned char no1:1;
unsigned char no2:1;
unsigned char no3:1;
unsigned char no4:1;
unsigned char no5:1;
unsigned char no6:1;
unsigned char no7:1;
unsigned char no8:1;
unsigned char no9:1;
unsigned char no10:1;
unsigned char no11:1;
unsigned char no12:1;
unsigned char no13:1;
unsigned char no14:1;
unsigned char no15:1;
} __bitf_T2;
#define ADM2 (*(volatile __near unsigned char *)0x10)
#define ADM2_bit (*(volatile __near __bitf_T *)0x10)
#define ADTYP (((volatile __near __bitf_T *)0x10)->no0)
#define AWC (((volatile __near __bitf_T *)0x10)->no2)
#define ADRCK (((volatile __near __bitf_T *)0x10)->no3)
#define ADUL (*(volatile __near unsigned char *)0x11)
#define ADLL (*(volatile __near unsigned char *)0x12)
#define ADTES (*(volatile __near unsigned char *)0x13)
#define PU1 (*(volatile __near unsigned char *)0x31)
#define PU1_bit (*(volatile __near __bitf_T *)0x31)
#define PU4 (*(volatile __near unsigned char *)0x34)
#define PU4_bit (*(volatile __near __bitf_T *)0x34)
#define PU12 (*(volatile __near unsigned char *)0x3C)
#define PU12_bit (*(volatile __near __bitf_T *)0x3C)
#define PIM1 (*(volatile __near unsigned char *)0x41)
#define PIM1_bit (*(volatile __near __bitf_T *)0x41)
#define POM1 (*(volatile __near unsigned char *)0x51)
#define POM1_bit (*(volatile __near __bitf_T *)0x51)
#define POM4 (*(volatile __near unsigned char *)0x54)
#define POM4_bit (*(volatile __near __bitf_T *)0x54)
#define PMC1 (*(volatile __near unsigned char *)0x61)
#define PMC1_bit (*(volatile __near __bitf_T *)0x61)
#define PMC4 (*(volatile __near unsigned char *)0x64)
#define PMC4_bit (*(volatile __near __bitf_T *)0x64)
#define NFEN0 (*(volatile __near unsigned char *)0x70)
#define NFEN0_bit (*(volatile __near __bitf_T *)0x70)
#define NFEN1 (*(volatile __near unsigned char *)0x71)
#define NFEN1_bit (*(volatile __near __bitf_T *)0x71)
#define ISC (*(volatile __near unsigned char *)0x73)
#define ISC_bit (*(volatile __near __bitf_T *)0x73)
#define TIS0 (*(volatile __near unsigned char *)0x74)
#define ADPC (*(volatile __near unsigned char *)0x76)
#define PIOR (*(volatile __near unsigned char *)0x77)
#define IAWCTL (*(volatile __near unsigned char *)0x78)
#define DFLCTL (*(volatile __near unsigned char *)0x90)
#define DFLCTL_bit (*(volatile __near __bitf_T *)0x90)
#define DFLEN (((volatile __near __bitf_T *)0x90)->no0)
#define HIOTRM (*(volatile __near unsigned char *)0xA0)
#define HOCODIV (*(volatile __near unsigned char *)0xA8)
#define TEMPCAL0 (*(volatile __near unsigned char *)0xAC)
#define TEMPCAL1 (*(volatile __near unsigned char *)0xAD)
#define TEMPCAL2 (*(volatile __near unsigned char *)0xAE)
#define TEMPCAL3 (*(volatile __near unsigned char *)0xAF)
#define MDCL (*(volatile __near unsigned short *)0xE0)
#define MDCH (*(volatile __near unsigned short *)0xE2)
#define MDUC (*(volatile __near unsigned char *)0xE8)
#define MDUC_bit (*(volatile __near __bitf_T *)0xE8)
#define DIVST (((volatile __near __bitf_T *)0xE8)->no0)
#define MACSF (((volatile __near __bitf_T *)0xE8)->no1)
#define MACOF (((volatile __near __bitf_T *)0xE8)->no2)
#define MDSM (((volatile __near __bitf_T *)0xE8)->no3)
#define MACMODE (((volatile __near __bitf_T *)0xE8)->no6)
#define DIVMODE (((volatile __near __bitf_T *)0xE8)->no7)
#define PER0 (*(volatile __near unsigned char *)0xF0)
#define PER0_bit (*(volatile __near __bitf_T *)0xF0)
#define TAU0EN (((volatile __near __bitf_T *)0xF0)->no0)
#define SAU0EN (((volatile __near __bitf_T *)0xF0)->no2)
#define IICA0EN (((volatile __near __bitf_T *)0xF0)->no4)
#define ADCEN (((volatile __near __bitf_T *)0xF0)->no5)
#define TMKAEN (((volatile __near __bitf_T *)0xF0)->no7)
#define OSMC (*(volatile __near unsigned char *)0xF3)
#define RMC (*(volatile __near unsigned char *)0xF4)
#define RMC_bit (*(volatile __near __bitf_T *)0xF4)
#define WDVOL (((volatile __near __bitf_T *)0xF4)->no7)
#define RPECTL (*(volatile __near unsigned char *)0xF5)
#define RPECTL_bit (*(volatile __near __bitf_T *)0xF5)
#define RPEF (((volatile __near __bitf_T *)0xF5)->no0)
#define RPERDIS (((volatile __near __bitf_T *)0xF5)->no7)
#define BCDADJ (*(volatile __near unsigned char *)0xFE)
#define SSR00 (*(volatile __near unsigned short *)0x100)
#define SSR00L (*(volatile __near unsigned char *)0x100)
#define SSR01 (*(volatile __near unsigned short *)0x102)
#define SSR01L (*(volatile __near unsigned char *)0x102)
#define SIR00 (*(volatile __near unsigned short *)0x108)
#define SIR00L (*(volatile __near unsigned char *)0x108)
#define SIR01 (*(volatile __near unsigned short *)0x10A)
#define SIR01L (*(volatile __near unsigned char *)0x10A)
#define SMR00 (*(volatile __near unsigned short *)0x110)
#define SMR01 (*(volatile __near unsigned short *)0x112)
#define SCR00 (*(volatile __near unsigned short *)0x118)
#define SCR01 (*(volatile __near unsigned short *)0x11A)
#define SE0 (*(volatile __near unsigned short *)0x120)
#define SE0L (*(volatile __near unsigned char *)0x120)
#define SE0L_bit (*(volatile __near __bitf_T *)0x120)
#define SS0 (*(volatile __near unsigned short *)0x122)
#define SS0L (*(volatile __near unsigned char *)0x122)
#define SS0L_bit (*(volatile __near __bitf_T *)0x122)
#define ST0 (*(volatile __near unsigned short *)0x124)
#define ST0L (*(volatile __near unsigned char *)0x124)
#define ST0L_bit (*(volatile __near __bitf_T *)0x124)
#define SPS0 (*(volatile __near unsigned short *)0x126)
#define SPS0L (*(volatile __near unsigned char *)0x126)
#define SO0 (*(volatile __near unsigned short *)0x128)
#define SOE0 (*(volatile __near unsigned short *)0x12A)
#define SOE0L (*(volatile __near unsigned char *)0x12A)
#define SOE0L_bit (*(volatile __near __bitf_T *)0x12A)
#define SOL0 (*(volatile __near unsigned short *)0x134)
#define SOL0L (*(volatile __near unsigned char *)0x134)
#define SSC0 (*(volatile __near unsigned short *)0x138)
#define SSC0L (*(volatile __near unsigned char *)0x138)
#define TCR00 (*(volatile __near unsigned short *)0x180)
#define TCR01 (*(volatile __near unsigned short *)0x182)
#define TCR02 (*(volatile __near unsigned short *)0x184)
#define TCR03 (*(volatile __near unsigned short *)0x186)
#define TMR00 (*(volatile __near unsigned short *)0x190)
#define TMR01 (*(volatile __near unsigned short *)0x192)
#define TMR02 (*(volatile __near unsigned short *)0x194)
#define TMR03 (*(volatile __near unsigned short *)0x196)
#define TSR00 (*(volatile __near unsigned short *)0x1A0)
#define TSR00L (*(volatile __near unsigned char *)0x1A0)
#define TSR01 (*(volatile __near unsigned short *)0x1A2)
#define TSR01L (*(volatile __near unsigned char *)0x1A2)
#define TSR02 (*(volatile __near unsigned short *)0x1A4)
#define TSR02L (*(volatile __near unsigned char *)0x1A4)
#define TSR03 (*(volatile __near unsigned short *)0x1A6)
#define TSR03L (*(volatile __near unsigned char *)0x1A6)
#define TE0 (*(volatile __near unsigned short *)0x1B0)
#define TE0L (*(volatile __near unsigned char *)0x1B0)
#define TE0L_bit (*(volatile __near __bitf_T *)0x1B0)
#define TS0 (*(volatile __near unsigned short *)0x1B2)
#define TS0L (*(volatile __near unsigned char *)0x1B2)
#define TS0L_bit (*(volatile __near __bitf_T *)0x1B2)
#define TT0 (*(volatile __near unsigned short *)0x1B4)
#define TT0L (*(volatile __near unsigned char *)0x1B4)
#define TT0L_bit (*(volatile __near __bitf_T *)0x1B4)
#define TPS0 (*(volatile __near unsigned short *)0x1B6)
#define TO0 (*(volatile __near unsigned short *)0x1B8)
#define TO0L (*(volatile __near unsigned char *)0x1B8)
#define TOE0 (*(volatile __near unsigned short *)0x1BA)
#define TOE0L (*(volatile __near unsigned char *)0x1BA)
#define TOE0L_bit (*(volatile __near __bitf_T *)0x1BA)
#define TOL0 (*(volatile __near unsigned short *)0x1BC)
#define TOL0L (*(volatile __near unsigned char *)0x1BC)
#define TOM0 (*(volatile __near unsigned short *)0x1BE)
#define TOM0L (*(volatile __near unsigned char *)0x1BE)
#define IICCTL00 (*(volatile __near unsigned char *)0x230)
#define IICCTL00_bit (*(volatile __near __bitf_T *)0x230)
#define SPT0 (((volatile __near __bitf_T *)0x230)->no0)
#define STT0 (((volatile __near __bitf_T *)0x230)->no1)
#define ACKE0 (((volatile __near __bitf_T *)0x230)->no2)
#define WTIM0 (((volatile __near __bitf_T *)0x230)->no3)
#define SPIE0 (((volatile __near __bitf_T *)0x230)->no4)
#define WREL0 (((volatile __near __bitf_T *)0x230)->no5)
#define LREL0 (((volatile __near __bitf_T *)0x230)->no6)
#define IICE0 (((volatile __near __bitf_T *)0x230)->no7)
#define IICCTL01 (*(volatile __near unsigned char *)0x231)
#define IICCTL01_bit (*(volatile __near __bitf_T *)0x231)
#define PRS0 (((volatile __near __bitf_T *)0x231)->no0)
#define DFC0 (((volatile __near __bitf_T *)0x231)->no2)
#define SMC0 (((volatile __near __bitf_T *)0x231)->no3)
#define DAD0 (((volatile __near __bitf_T *)0x231)->no4)
#define CLD0 (((volatile __near __bitf_T *)0x231)->no5)
#define WUP0 (((volatile __near __bitf_T *)0x231)->no7)
#define IICWL0 (*(volatile __near unsigned char *)0x232)
#define IICWH0 (*(volatile __near unsigned char *)0x233)
#define SVA0 (*(volatile __near unsigned char *)0x234)
#define CRCD (*(volatile __near unsigned short *)0x2FA)
#define P1 (*(volatile __near unsigned char *)0xFF01)
#define P1_bit (*(volatile __near __bitf_T *)0xFF01)
#define P2 (*(volatile __near unsigned char *)0xFF02)
#define P2_bit (*(volatile __near __bitf_T *)0xFF02)
#define P4 (*(volatile __near unsigned char *)0xFF04)
#define P4_bit (*(volatile __near __bitf_T *)0xFF04)
#define P6 (*(volatile __near unsigned char *)0xFF06)
#define P6_bit (*(volatile __near __bitf_T *)0xFF06)
#define P12 (*(volatile __near unsigned char *)0xFF0C)
#define P12_bit (*(volatile __near __bitf_T *)0xFF0C)
#define P13 (*(volatile __near unsigned char *)0xFF0D)
#define P13_bit (*(volatile __near __bitf_T *)0xFF0D)
#define SDR00 (*(volatile __near unsigned short *)0xFF10)
#define SIO00 (*(volatile __near unsigned char *)0xFF10)
#define TXD0 (*(volatile __near unsigned char *)0xFF10)
#define SDR01 (*(volatile __near unsigned short *)0xFF12)
#define RXD0 (*(volatile __near unsigned char *)0xFF12)
#define SIO01 (*(volatile __near unsigned char *)0xFF12)
#define TDR00 (*(volatile __near unsigned short *)0xFF18)
#define TDR01 (*(volatile __near unsigned short *)0xFF1A)
#define TDR01L (*(volatile __near unsigned char *)0xFF1A)
#define TDR01H (*(volatile __near unsigned char *)0xFF1B)
#define ADCR (*(volatile __near unsigned short *)0xFF1E)
#define ADCRH (*(volatile __near unsigned char *)0xFF1F)
#define PM1 (*(volatile __near unsigned char *)0xFF21)
#define PM1_bit (*(volatile __near __bitf_T *)0xFF21)
#define PM2 (*(volatile __near unsigned char *)0xFF22)
#define PM2_bit (*(volatile __near __bitf_T *)0xFF22)
#define PM4 (*(volatile __near unsigned char *)0xFF24)
#define PM4_bit (*(volatile __near __bitf_T *)0xFF24)
#define PM6 (*(volatile __near unsigned char *)0xFF26)
#define PM6_bit (*(volatile __near __bitf_T *)0xFF26)
#define ADM0 (*(volatile __near unsigned char *)0xFF30)
#define ADM0_bit (*(volatile __near __bitf_T *)0xFF30)
#define ADCE (((volatile __near __bitf_T *)0xFF30)->no0)
#define ADCS (((volatile __near __bitf_T *)0xFF30)->no7)
#define ADS (*(volatile __near unsigned char *)0xFF31)
#define ADS_bit (*(volatile __near __bitf_T *)0xFF31)
#define ADM1 (*(volatile __near unsigned char *)0xFF32)
#define ADM1_bit (*(volatile __near __bitf_T *)0xFF32)
#define KRCTL (*(volatile __near unsigned char *)0xFF34)
#define KRCTL_bit (*(volatile __near __bitf_T *)0xFF34)
#define KRF (*(volatile __near unsigned char *)0xFF35)
#define KRM0 (*(volatile __near unsigned char *)0xFF37)
#define KRM0_bit (*(volatile __near __bitf_T *)0xFF37)
#define EGP0 (*(volatile __near unsigned char *)0xFF38)
#define EGP0_bit (*(volatile __near __bitf_T *)0xFF38)
#define EGN0 (*(volatile __near unsigned char *)0xFF39)
#define EGN0_bit (*(volatile __near __bitf_T *)0xFF39)
#define IICA0 (*(volatile __near unsigned char *)0xFF50)
#define IICS0 (*(volatile __near unsigned char *)0xFF51)
#define IICS0_bit (*(volatile __near __bitf_T *)0xFF51)
#define SPD0 (((volatile __near __bitf_T *)0xFF51)->no0)
#define STD0 (((volatile __near __bitf_T *)0xFF51)->no1)
#define ACKD0 (((volatile __near __bitf_T *)0xFF51)->no2)
#define TRC0 (((volatile __near __bitf_T *)0xFF51)->no3)
#define COI0 (((volatile __near __bitf_T *)0xFF51)->no4)
#define EXC0 (((volatile __near __bitf_T *)0xFF51)->no5)
#define ALD0 (((volatile __near __bitf_T *)0xFF51)->no6)
#define MSTS0 (((volatile __near __bitf_T *)0xFF51)->no7)
#define IICF0 (*(volatile __near unsigned char *)0xFF52)
#define IICF0_bit (*(volatile __near __bitf_T *)0xFF52)
#define IICRSV0 (((volatile __near __bitf_T *)0xFF52)->no0)
#define STCEN0 (((volatile __near __bitf_T *)0xFF52)->no1)
#define IICBSY0 (((volatile __near __bitf_T *)0xFF52)->no6)
#define STCF0 (((volatile __near __bitf_T *)0xFF52)->no7)
#define TDR02 (*(volatile __near unsigned short *)0xFF64)
#define TDR03 (*(volatile __near unsigned short *)0xFF66)
#define TDR03L (*(volatile __near unsigned char *)0xFF66)
#define TDR03H (*(volatile __near unsigned char *)0xFF67)
#define ITMC (*(volatile __near unsigned short *)0xFF90)
#define CMC (*(volatile __near unsigned char *)0xFFA0)
#define CSC (*(volatile __near unsigned char *)0xFFA1)
#define CSC_bit (*(volatile __near __bitf_T *)0xFFA1)
#define HIOSTOP (((volatile __near __bitf_T *)0xFFA1)->no0)
#define MSTOP (((volatile __near __bitf_T *)0xFFA1)->no7)
#define OSTC (*(volatile __near unsigned char *)0xFFA2)
#define OSTC_bit (*(volatile __near __bitf_T *)0xFFA2)
#define OSTS (*(volatile __near unsigned char *)0xFFA3)
#define CKC (*(volatile __near unsigned char *)0xFFA4)
#define CKC_bit (*(volatile __near __bitf_T *)0xFFA4)
#define MCM0 (((volatile __near __bitf_T *)0xFFA4)->no4)
#define MCS (((volatile __near __bitf_T *)0xFFA4)->no5)
#define CKS0 (*(volatile __near unsigned char *)0xFFA5)
#define CKS0_bit (*(volatile __near __bitf_T *)0xFFA5)
#define PCLOE0 (((volatile __near __bitf_T *)0xFFA5)->no7)
#define RESF (*(volatile __near unsigned char *)0xFFA8)
#define LVIM (*(volatile __near unsigned char *)0xFFA9)
#define LVIM_bit (*(volatile __near __bitf_T *)0xFFA9)
#define LVIF (((volatile __near __bitf_T *)0xFFA9)->no0)
#define LVIOMSK (((volatile __near __bitf_T *)0xFFA9)->no1)
#define LVISEN (((volatile __near __bitf_T *)0xFFA9)->no7)
#define LVIS (*(volatile __near unsigned char *)0xFFAA)
#define LVIS_bit (*(volatile __near __bitf_T *)0xFFAA)
#define LVILV (((volatile __near __bitf_T *)0xFFAA)->no0)
#define LVIMD (((volatile __near __bitf_T *)0xFFAA)->no7)
#define WDTE (*(volatile __near unsigned char *)0xFFAB)
#define CRCIN (*(volatile __near unsigned char *)0xFFAC)
#define DSA0 (*(volatile __near unsigned char *)0xFFB0)
#define DSA1 (*(volatile __near unsigned char *)0xFFB1)
#define DRA0 (*(volatile __near unsigned short *)0xFFB2)
#define DRA0L (*(volatile __near unsigned char *)0xFFB2)
#define DRA0H (*(volatile __near unsigned char *)0xFFB3)
#define DRA1 (*(volatile __near unsigned short *)0xFFB4)
#define DRA1L (*(volatile __near unsigned char *)0xFFB4)
#define DRA1H (*(volatile __near unsigned char *)0xFFB5)
#define DBC0 (*(volatile __near unsigned short *)0xFFB6)
#define DBC0L (*(volatile __near unsigned char *)0xFFB6)
#define DBC0H (*(volatile __near unsigned char *)0xFFB7)
#define DBC1 (*(volatile __near unsigned short *)0xFFB8)
#define DBC1L (*(volatile __near unsigned char *)0xFFB8)
#define DBC1H (*(volatile __near unsigned char *)0xFFB9)
#define DMC0 (*(volatile __near unsigned char *)0xFFBA)
#define DMC0_bit (*(volatile __near __bitf_T *)0xFFBA)
#define DWAIT0 (((volatile __near __bitf_T *)0xFFBA)->no4)
#define DS0 (((volatile __near __bitf_T *)0xFFBA)->no5)
#define DRS0 (((volatile __near __bitf_T *)0xFFBA)->no6)
#define STG0 (((volatile __near __bitf_T *)0xFFBA)->no7)
#define DMC1 (*(volatile __near unsigned char *)0xFFBB)
#define DMC1_bit (*(volatile __near __bitf_T *)0xFFBB)
#define DWAIT1 (((volatile __near __bitf_T *)0xFFBB)->no4)
#define DS1 (((volatile __near __bitf_T *)0xFFBB)->no5)
#define DRS1 (((volatile __near __bitf_T *)0xFFBB)->no6)
#define STG1 (((volatile __near __bitf_T *)0xFFBB)->no7)
#define DRC0 (*(volatile __near unsigned char *)0xFFBC)
#define DRC0_bit (*(volatile __near __bitf_T *)0xFFBC)
#define DST0 (((volatile __near __bitf_T *)0xFFBC)->no0)
#define DEN0 (((volatile __near __bitf_T *)0xFFBC)->no7)
#define DRC1 (*(volatile __near unsigned char *)0xFFBD)
#define DRC1_bit (*(volatile __near __bitf_T *)0xFFBD)
#define DST1 (((volatile __near __bitf_T *)0xFFBD)->no0)
#define DEN1 (((volatile __near __bitf_T *)0xFFBD)->no7)
#define IF0 (*(volatile __near unsigned short *)0xFFE0)
#define IF0L (*(volatile __near unsigned char *)0xFFE0)
#define IF0L_bit (*(volatile __near __bitf_T *)0xFFE0)
#define IF0H (*(volatile __near unsigned char *)0xFFE1)
#define IF0H_bit (*(volatile __near __bitf_T *)0xFFE1)
#define WDTIIF (((volatile __near __bitf_T *)0xFFE0)->no0)
#define LVIIF (((volatile __near __bitf_T *)0xFFE0)->no1)
#define PIF0 (((volatile __near __bitf_T *)0xFFE0)->no2)
#define PIF1 (((volatile __near __bitf_T *)0xFFE0)->no3)
#define PIF2 (((volatile __near __bitf_T *)0xFFE0)->no4)
#define PIF3 (((volatile __near __bitf_T *)0xFFE0)->no5)
#define DMAIF0 (((volatile __near __bitf_T *)0xFFE0)->no6)
#define DMAIF1 (((volatile __near __bitf_T *)0xFFE0)->no7)
#define CSIIF00 (((volatile __near __bitf_T *)0xFFE1)->no0)
#define IICIF00 (((volatile __near __bitf_T *)0xFFE1)->no0)
#define STIF0 (((volatile __near __bitf_T *)0xFFE1)->no0)
#define CSIIF01 (((volatile __near __bitf_T *)0xFFE1)->no1)
#define IICIF01 (((volatile __near __bitf_T *)0xFFE1)->no1)
#define SRIF0 (((volatile __near __bitf_T *)0xFFE1)->no1)
#define SREIF0 (((volatile __near __bitf_T *)0xFFE1)->no2)
#define TMIF01H (((volatile __near __bitf_T *)0xFFE1)->no3)
#define TMIF03H (((volatile __near __bitf_T *)0xFFE1)->no4)
#define IICAIF0 (((volatile __near __bitf_T *)0xFFE1)->no5)
#define TMIF00 (((volatile __near __bitf_T *)0xFFE1)->no6)
#define TMIF01 (((volatile __near __bitf_T *)0xFFE1)->no7)
#define IF1 (*(volatile __near unsigned short *)0xFFE2)
#define IF1L (*(volatile __near unsigned char *)0xFFE2)
#define IF1L_bit (*(volatile __near __bitf_T *)0xFFE2)
#define TMIF02 (((volatile __near __bitf_T *)0xFFE2)->no0)
#define TMIF03 (((volatile __near __bitf_T *)0xFFE2)->no1)
#define ADIF (((volatile __near __bitf_T *)0xFFE2)->no2)
#define TMKAIF (((volatile __near __bitf_T *)0xFFE2)->no3)
#define KRIF (((volatile __near __bitf_T *)0xFFE2)->no4)
#define MDIF (((volatile __near __bitf_T *)0xFFE2)->no5)
#define FLIF (((volatile __near __bitf_T *)0xFFE2)->no6)
#define MK0 (*(volatile __near unsigned short *)0xFFE4)
#define MK0L (*(volatile __near unsigned char *)0xFFE4)
#define MK0L_bit (*(volatile __near __bitf_T *)0xFFE4)
#define MK0H (*(volatile __near unsigned char *)0xFFE5)
#define MK0H_bit (*(volatile __near __bitf_T *)0xFFE5)
#define WDTIMK (((volatile __near __bitf_T *)0xFFE4)->no0)
#define LVIMK (((volatile __near __bitf_T *)0xFFE4)->no1)
#define PMK0 (((volatile __near __bitf_T *)0xFFE4)->no2)
#define PMK1 (((volatile __near __bitf_T *)0xFFE4)->no3)
#define PMK2 (((volatile __near __bitf_T *)0xFFE4)->no4)
#define PMK3 (((volatile __near __bitf_T *)0xFFE4)->no5)
#define DMAMK0 (((volatile __near __bitf_T *)0xFFE4)->no6)
#define DMAMK1 (((volatile __near __bitf_T *)0xFFE4)->no7)
#define CSIMK00 (((volatile __near __bitf_T *)0xFFE5)->no0)
#define IICMK00 (((volatile __near __bitf_T *)0xFFE5)->no0)
#define STMK0 (((volatile __near __bitf_T *)0xFFE5)->no0)
#define CSIMK01 (((volatile __near __bitf_T *)0xFFE5)->no1)
#define IICMK01 (((volatile __near __bitf_T *)0xFFE5)->no1)
#define SRMK0 (((volatile __near __bitf_T *)0xFFE5)->no1)
#define SREMK0 (((volatile __near __bitf_T *)0xFFE5)->no2)
#define TMMK01H (((volatile __near __bitf_T *)0xFFE5)->no3)
#define TMMK03H (((volatile __near __bitf_T *)0xFFE5)->no4)
#define IICAMK0 (((volatile __near __bitf_T *)0xFFE5)->no5)
#define TMMK00 (((volatile __near __bitf_T *)0xFFE5)->no6)
#define TMMK01 (((volatile __near __bitf_T *)0xFFE5)->no7)
#define MK1 (*(volatile __near unsigned short *)0xFFE6)
#define MK1L (*(volatile __near unsigned char *)0xFFE6)
#define MK1L_bit (*(volatile __near __bitf_T *)0xFFE6)
#define TMMK02 (((volatile __near __bitf_T *)0xFFE6)->no0)
#define TMMK03 (((volatile __near __bitf_T *)0xFFE6)->no1)
#define ADMK (((volatile __near __bitf_T *)0xFFE6)->no2)
#define TMKAMK (((volatile __near __bitf_T *)0xFFE6)->no3)
#define KRMK (((volatile __near __bitf_T *)0xFFE6)->no4)
#define MDMK (((volatile __near __bitf_T *)0xFFE6)->no5)
#define FLMK (((volatile __near __bitf_T *)0xFFE6)->no6)
#define PR00 (*(volatile __near unsigned short *)0xFFE8)
#define PR00L (*(volatile __near unsigned char *)0xFFE8)
#define PR00L_bit (*(volatile __near __bitf_T *)0xFFE8)
#define PR00H (*(volatile __near unsigned char *)0xFFE9)
#define PR00H_bit (*(volatile __near __bitf_T *)0xFFE9)
#define WDTIPR0 (((volatile __near __bitf_T *)0xFFE8)->no0)
#define LVIPR0 (((volatile __near __bitf_T *)0xFFE8)->no1)
#define PPR00 (((volatile __near __bitf_T *)0xFFE8)->no2)
#define PPR01 (((volatile __near __bitf_T *)0xFFE8)->no3)
#define PPR02 (((volatile __near __bitf_T *)0xFFE8)->no4)
#define PPR03 (((volatile __near __bitf_T *)0xFFE8)->no5)
#define DMAPR00 (((volatile __near __bitf_T *)0xFFE8)->no6)
#define DMAPR01 (((volatile __near __bitf_T *)0xFFE8)->no7)
#define CSIPR000 (((volatile __near __bitf_T *)0xFFE9)->no0)
#define IICPR000 (((volatile __near __bitf_T *)0xFFE9)->no0)
#define STPR00 (((volatile __near __bitf_T *)0xFFE9)->no0)
#define CSIPR001 (((volatile __near __bitf_T *)0xFFE9)->no1)
#define IICPR001 (((volatile __near __bitf_T *)0xFFE9)->no1)
#define SRPR00 (((volatile __near __bitf_T *)0xFFE9)->no1)
#define SREPR00 (((volatile __near __bitf_T *)0xFFE9)->no2)
#define TMPR001H (((volatile __near __bitf_T *)0xFFE9)->no3)
#define TMPR003H (((volatile __near __bitf_T *)0xFFE9)->no4)
#define IICAPR00 (((volatile __near __bitf_T *)0xFFE9)->no5)
#define TMPR000 (((volatile __near __bitf_T *)0xFFE9)->no6)
#define TMPR001 (((volatile __near __bitf_T *)0xFFE9)->no7)
#define PR01 (*(volatile __near unsigned short *)0xFFEA)
#define PR01L (*(volatile __near unsigned char *)0xFFEA)
#define PR01L_bit (*(volatile __near __bitf_T *)0xFFEA)
#define TMPR002 (((volatile __near __bitf_T *)0xFFEA)->no0)
#define TMPR003 (((volatile __near __bitf_T *)0xFFEA)->no1)
#define ADPR0 (((volatile __near __bitf_T *)0xFFEA)->no2)
#define TMKAPR0 (((volatile __near __bitf_T *)0xFFEA)->no3)
#define KRPR0 (((volatile __near __bitf_T *)0xFFEA)->no4)
#define MDPR0 (((volatile __near __bitf_T *)0xFFEA)->no5)
#define FLPR0 (((volatile __near __bitf_T *)0xFFEA)->no6)
#define PR10 (*(volatile __near unsigned short *)0xFFEC)
#define PR10L (*(volatile __near unsigned char *)0xFFEC)
#define PR10L_bit (*(volatile __near __bitf_T *)0xFFEC)
#define PR10H (*(volatile __near unsigned char *)0xFFED)
#define PR10H_bit (*(volatile __near __bitf_T *)0xFFED)
#define WDTIPR1 (((volatile __near __bitf_T *)0xFFEC)->no0)
#define LVIPR1 (((volatile __near __bitf_T *)0xFFEC)->no1)
#define PPR10 (((volatile __near __bitf_T *)0xFFEC)->no2)
#define PPR11 (((volatile __near __bitf_T *)0xFFEC)->no3)
#define PPR12 (((volatile __near __bitf_T *)0xFFEC)->no4)
#define PPR13 (((volatile __near __bitf_T *)0xFFEC)->no5)
#define DMAPR10 (((volatile __near __bitf_T *)0xFFEC)->no6)
#define DMAPR11 (((volatile __near __bitf_T *)0xFFEC)->no7)
#define CSIPR100 (((volatile __near __bitf_T *)0xFFED)->no0)
#define IICPR100 (((volatile __near __bitf_T *)0xFFED)->no0)
#define STPR10 (((volatile __near __bitf_T *)0xFFED)->no0)
#define CSIPR101 (((volatile __near __bitf_T *)0xFFED)->no1)
#define IICPR101 (((volatile __near __bitf_T *)0xFFED)->no1)
#define SRPR10 (((volatile __near __bitf_T *)0xFFED)->no1)
#define SREPR10 (((volatile __near __bitf_T *)0xFFED)->no2)
#define TMPR101H (((volatile __near __bitf_T *)0xFFED)->no3)
#define TMPR103H (((volatile __near __bitf_T *)0xFFED)->no4)
#define IICAPR10 (((volatile __near __bitf_T *)0xFFED)->no5)
#define TMPR100 (((volatile __near __bitf_T *)0xFFED)->no6)
#define TMPR101 (((volatile __near __bitf_T *)0xFFED)->no7)
#define PR11 (*(volatile __near unsigned short *)0xFFEE)
#define PR11L (*(volatile __near unsigned char *)0xFFEE)
#define PR11L_bit (*(volatile __near __bitf_T *)0xFFEE)
#define TMPR102 (((volatile __near __bitf_T *)0xFFEE)->no0)
#define TMPR103 (((volatile __near __bitf_T *)0xFFEE)->no1)
#define ADPR1 (((volatile __near __bitf_T *)0xFFEE)->no2)
#define TMKAPR1 (((volatile __near __bitf_T *)0xFFEE)->no3)
#define KRPR1 (((volatile __near __bitf_T *)0xFFEE)->no4)
#define MDPR1 (((volatile __near __bitf_T *)0xFFEE)->no5)
#define FLPR1 (((volatile __near __bitf_T *)0xFFEE)->no6)
#define MDAL (*(volatile __near unsigned short *)0xFFF0)
#define MULA (*(volatile __near unsigned short *)0xFFF0)
#define MDAH (*(volatile __near unsigned short *)0xFFF2)
#define MULB (*(volatile __near unsigned short *)0xFFF2)
#define MDBH (*(volatile __near unsigned short *)0xFFF4)
#define MULOH (*(volatile __near unsigned short *)0xFFF4)
#define MDBL (*(volatile __near unsigned short *)0xFFF6)
#define MULOL (*(volatile __near unsigned short *)0xFFF6)
#define PMC (*(volatile __near unsigned char *)0xFFFE)
#define PMC_bit (*(volatile __near __bitf_T *)0xFFFE)
#define MAA (((volatile __near __bitf_T *)0xFFFE)->no0)
#define INTWDTI 0x0004
#define INTLVI 0x0006
#define INTP0 0x0008
#define INTP1 0x000A
#define INTP2 0x000C
#define INTP3 0x000E
#define INTDMA0 0x0010
#define INTDMA1 0x0012
#define INTCSI00 0x0014
#define INTIIC00 0x0014
#define INTST0 0x0014
#define INTCSI01 0x0016
#define INTIIC01 0x0016
#define INTSR0 0x0016
#define INTSRE0 0x0018
#define INTTM01H 0x001A
#define INTTM03H 0x001C
#define INTIICA0 0x001E
#define INTTM00 0x0020
#define INTTM01 0x0022
#define INTTM02 0x0024
#define INTTM03 0x0026
#define INTAD 0x0028
#define INTIT 0x002A
#define INTKR 0x002C
#define INTMD 0x002E
#define INTFL 0x0030
#endif

8
bl_fc/myDef.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef __MYDEF_H__
#define __MYDEF_H__
#endif

139
bl_fc/r_cg_adc.c Normal file
View File

@ -0,0 +1,139 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_adc.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for ADC module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_adc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_ADC_Create
* Description : This function initializes the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Create(void)
{
ADCEN = 1U; /* supply AD clock */
ADM0 = _00_AD_ADM0_INITIALVALUE; /* disable AD conversion and clear ADM0 register */
ADMK = 1U; /* disable INTAD interrupt */
ADIF = 0U; /* clear INTAD interrupt flag */
/* Set INTAD low priority */
ADPR1 = 1U;
ADPR0 = 1U;
/* The reset status of ADPC is analog input, so it's unnecessary to set. */
/* Set ANI19 pin */
PMC1 |= 0x08U;
PM1 |= 0x08U;
ADM0 = _08_AD_CONVERSION_CLOCK_32 | _02_AD_TIME_MODE_NORMAL_2 | _00_AD_OPERMODE_SELECT;
ADM1 = _80_AD_TRIGGER_HARDWARE_NOWAIT | _20_AD_CONVMODE_ONESELECT | _00_AD_TRIGGER_INTTM01;
ADM2 = _00_AD_POSITIVE_VDD | _00_AD_NEGATIVE_VSS | _00_AD_AREA_MODE_1 | _00_AD_RESOLUTION_10BIT;
ADUL = _FF_AD_ADUL_VALUE;
ADLL = _00_AD_ADLL_VALUE;
ADS = _13_AD_INPUT_CHANNEL_19;
ADCE = 1U; /* enable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Start
* Description : This function starts the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Start(void)
{
ADIF = 0U; /* clear INTAD interrupt flag */
ADMK = 0U; /* enable INTAD interrupt */
ADCS = 1U; /* enable AD conversion */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Stop
* Description : This function stops the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Stop(void)
{
ADCS = 0U; /* disable AD conversion */
ADMK = 1U; /* disable INTAD interrupt */
ADIF = 0U; /* clear INTAD interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Set_OperationOn
* Description : This function enables comparator operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Set_OperationOn(void)
{
ADCE = 1U; /* enable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Set_OperationOff
* Description : This function stops comparator operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Set_OperationOff(void)
{
ADCE = 0U; /* disable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Get_Result
* Description : This function returns the conversion result in the buffer.
* Arguments : buffer -
* the address where to write the conversion result
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Get_Result(uint16_t * const buffer)
{
*buffer = (uint16_t)(ADCR >> 6U);
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

179
bl_fc/r_cg_adc.h Normal file
View File

@ -0,0 +1,179 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_adc.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for ADC module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef ADC_H
#define ADC_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Peripheral enable register 0 (PER0)
*/
/* Control of AD converter input clock (ADCEN) */
#define _00_AD_CLOCK_STOP (0x00U) /* stop supply of input clock */
#define _20_AD_CLOCK_SUPPLY (0x20U) /* supply input clock */
/*
AD converter mode register 0 (ADM0)
*/
#define _00_AD_ADM0_INITIALVALUE (0x00U)
/* AD conversion operation control (ADCS) */
#define _80_AD_CONVERSION_ENABLE (0x80U) /* enable AD conversion operation control */
#define _00_AD_CONVERSION_DISABLE (0x00U) /* disable AD conversion operation control */
/* Specification of AD conversion operation mode (ADMD) */
#define _00_AD_OPERMODE_SELECT (0x00U) /* select operation mode */
#define _40_AD_OPERMODE_SCAN (0x40U) /* scan operation mode */
/* AD conversion clock selection (FR2 - FR0) */
#define _00_AD_CONVERSION_CLOCK_64 (0x00U) /* fCLK/64 */
#define _08_AD_CONVERSION_CLOCK_32 (0x08U) /* fCLK/32 */
#define _10_AD_CONVERSION_CLOCK_16 (0x10U) /* fCLK/16 */
#define _18_AD_CONVERSION_CLOCK_8 (0x18U) /* fCLK/8 */
#define _20_AD_CONVERSION_CLOCK_6 (0x20U) /* fCLK/6 */
#define _28_AD_CONVERSION_CLOCK_5 (0x28U) /* fCLK/5 */
#define _30_AD_CONVERSION_CLOCK_4 (0x30U) /* fCLK/4 */
#define _38_AD_CONVERSION_CLOCK_2 (0x38U) /* fCLK/2 */
/* Specification AD conversion time mode (LV1, LV0) */
#define _00_AD_TIME_MODE_NORMAL_1 (0x00U) /* normal 1 mode */
#define _02_AD_TIME_MODE_NORMAL_2 (0x02U) /* normal 2 mode */
#define _04_AD_TIME_MODE_LOWVOLTAGE_1 (0x04U) /* low-voltage 1 mode */
#define _06_AD_TIME_MODE_LOWVOLTAGE_2 (0x06U) /* low-voltage 2 mode */
/* AD comparator operation control (ADCE) */
#define _01_AD_COMPARATOR_ENABLE (0x01U) /* enable comparator operation control */
#define _00_AD_COMPARATOR_DISABLE (0x00U) /* disable comparator operation control */
/*
Analog input channel specification register (ADS)
*/
/* Specification of analog input channel (ADISS, ADS4 - ADS0) */
/* Select mode */
#define _00_AD_INPUT_CHANNEL_0 (0x00U) /* ANI0 */
#define _01_AD_INPUT_CHANNEL_1 (0x01U) /* ANI1 */
#define _02_AD_INPUT_CHANNEL_2 (0x02U) /* ANI2 */
#define _03_AD_INPUT_CHANNEL_3 (0x03U) /* ANI3 */
#define _10_AD_INPUT_CHANNEL_16 (0x10U) /* ANI16 */
#define _11_AD_INPUT_CHANNEL_17 (0x11U) /* ANI17 */
#define _12_AD_INPUT_CHANNEL_18 (0x12U) /* ANI18 */
#define _13_AD_INPUT_CHANNEL_19 (0x13U) /* ANI19 */
#define _14_AD_INPUT_CHANNEL_20 (0x14U) /* ANI20 */
#define _15_AD_INPUT_CHANNEL_21 (0x15U) /* ANI21 */
#define _16_AD_INPUT_CHANNEL_22 (0x16U) /* ANI22 */
#define _80_AD_INPUT_TEMPERSENSOR_0 (0x80U) /* temperature sensor 0 output is used to be the input channel */
#define _81_AD_INPUT_INTERREFVOLT (0x81U) /* internal reference voltage output is used to be the input channel */
/* Scan mode */
#define _00_AD_INPUT_CHANNEL_0_3 (0x00U) /* ANI0 - ANI3 */
/*
AD converter mode register 1 (ADM1)
*/
/* AD trigger mode selection (ADTMD1, ADTMD0) */
#define _00_AD_TRIGGER_SOFTWARE (0x00U) /* software trigger mode */
#define _80_AD_TRIGGER_HARDWARE_NOWAIT (0x80U) /* hardware trigger mode (no wait) */
#define _C0_AD_TRIGGER_HARDWARE_WAIT (0xC0U) /* hardware trigger mode (wait) */
/* AD convertion mode selection (ADSCM) */
#define _00_AD_CONVMODE_CONSELECT (0x00U) /* continuous convertion mode */
#define _20_AD_CONVMODE_ONESELECT (0x20U) /* oneshot convertion mode */
/* Trigger signal selection (ADTRS1, ADTRS0) */
#define _00_AD_TRIGGER_INTTM01 (0x00U) /* INTTM01 */
#define _03_AD_TRIGGER_INTIT (0x03U) /* INTIT */
/*
AD converter mode register 2 (ADM2)
*/
/* AD VREF(+) selection (ADREFP1, ADREFP0) */
#define _00_AD_POSITIVE_VDD (0x00U) /* use VDD as VREF(+) */
#define _40_AD_POSITIVE_AVREFP (0x40U) /* use AVREFP as VREF(+) */
#define _80_AD_POSITIVE_INTERVOLT (0x80U) /* use internal voltage as VREF(+) */
/* AD VREF(-) selection (ADREFM) */
#define _00_AD_NEGATIVE_VSS (0x00U) /* use VSS as VREF(-) */
#define _20_AD_NEGATIVE_AVREFM (0x20U) /* use AVREFM as VREF(-) */
/* AD conversion result upper/lower bound value selection (ADRCK) */
#define _00_AD_AREA_MODE_1 (0x00U) /* generates INTAD when ADLL <= ADCRH <= ADUL */
#define _08_AD_AREA_MODE_2_3 (0x08U) /* generates INTAD when ADUL < ADCRH or ADLL > ADCRH */
/* AD wakeup function selection (AWC) */
#define _00_AD_WAKEUP_OFF (0x00U) /* stop wakeup function */
#define _04_AD_WAKEUP_ON (0x04U) /* use wakeup function */
/* AD resolution selection (ADTYP) */
#define _00_AD_RESOLUTION_10BIT (0x00U) /* 10 bits */
#define _01_AD_RESOLUTION_8BIT (0x01U) /* 8 bits */
/*
AD test function register (ADTES)
*/
/* AD test mode signal (ADTES1, ADTES0) */
#define _00_AD_NORMAL_INPUT (0x00U) /* normal mode */
#define _02_AD_TEST_AVREFM (0x02U) /* use AVREFM as test signal */
#define _03_AD_TEST_AVREFP (0x03U) /* use AVREFP as test signal */
/*
AD port configuration register (ADPC)
*/
/* Analog input/digital input switching (ADPC3 - ADPC0) */
#define _00_AD_ADPC_4ANALOG (0x00U) /* ANI0 - ANI3 */
#define _04_AD_ADPC_3ANALOG (0x04U) /* ANI0 - ANI2 */
#define _03_AD_ADPC_2ANALOG (0x03U) /* ANI0 - ANI1 */
#define _02_AD_ADPC_1ANALOG (0x02U) /* ANI0 */
#define _01_AD_ADPC_0ANALOG (0x01U) /* ANI0 - ANI4 (all digital) */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/* Upper bound (ADUL) value */
#define _FF_AD_ADUL_VALUE (0xFFU)
/* Upper bound (ADLL) value */
#define _00_AD_ADLL_VALUE (0x00U)
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef enum
{
ADCHANNEL0, ADCHANNEL1, ADCHANNEL2, ADCHANNEL3, ADCHANNEL16 = 16U,
ADCHANNEL17, ADCHANNEL18, ADCHANNEL19, ADCHANNEL20, ADCHANNEL21,
ADCHANNEL22, ADTEMPERSENSOR0 = 128U, ADINTERREFVOLT
} ad_channel_t;
typedef enum
{
ADNORMALINPUT,
ADAVREFM = 2U,
ADAVREFP
} test_channel_t;
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_ADC_Create(void);
void R_ADC_Start(void);
void R_ADC_Stop(void);
void R_ADC_Set_OperationOn(void);
void R_ADC_Set_OperationOff(void);
void R_ADC_Get_Result(uint16_t * const buffer);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

66
bl_fc/r_cg_adc_user.c Normal file
View File

@ -0,0 +1,66 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_adc_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for ADC module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_adc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_adc_interrupt(vect=INTAD)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
uint16_t g_adcval=0;
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_adc_interrupt
* Description : This function is INTAD interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_adc_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
R_ADC_Get_Result(&g_adcval);
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

69
bl_fc/r_cg_cgc.c Normal file
View File

@ -0,0 +1,69 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_cgc.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_CGC_Create
* Description : This function initializes the clock generator.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CGC_Create(void)
{
/* Set fMX */
CMC = _00_CGC_HISYS_PORT | _00_CGC_SYSOSC_DEFAULT;
MSTOP = 1U;
/* Set fMAIN */
MCM0 = 0U;
OSMC = _00_CGC_IT_CLK_NO;
/* Set fIH */
HIOSTOP = 0U;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

146
bl_fc/r_cg_cgc.h Normal file
View File

@ -0,0 +1,146 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_cgc.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef CGC_H
#define CGC_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Clock operation mode control register (CMC)
*/
/* High-speed system clock pin operation mode (EXCLK, OSCSEL) */
#define _C0_CGC_HISYS_PIN (0xC0U)
#define _00_CGC_HISYS_PORT (0x00U) /* X1, X2 as I/O port */
#define _40_CGC_HISYS_OSC (0x40U) /* X1, X2 as crystal/ceramic resonator connection */
#define _80_CGC_HISYS_PORT1 (0x80U) /* X1, X2 as I/O port */
#define _C0_CGC_HISYS_EXT (0xC0U) /* X1 as I/O port, X2 as external clock input */
/* Control of X1 high-speed system clock oscillation frequency (AMPH) */
#define _00_CGC_SYSOSC_DEFAULT (0x00U)
#define _00_CGC_SYSOSC_UNDER10M (0x00U) /* fX <= 10MHz */
#define _01_CGC_SYSOSC_OVER10M (0x01U) /* fX > 10MHz */
/*
Clock operation status control register (CSC)
*/
/* Control of high-speed system clock operation (MSTOP) */
#define _00_CGC_HISYS_OPER (0x00U) /* X1 oscillator/external clock operating */
#define _80_CGC_HISYS_STOP (0x80U) /* X1 oscillator/external clock stopped */
/* High-speed OCO operation (HIOSTOP) */
#define _00_CGC_HIO_OPER (0x00U) /* high-speed OCO operating */
#define _01_CGC_HIO_STOP (0x01U) /* high-speed OCO stopped */
/*
Oscillation stabilization time counter status register (OSTC)
*/
/* Oscillation stabilization time status (MOST18 - MOST8) */
#define _00_CGC_OSCSTAB_STA0 (0x00U) /* < 2^8/fX */
#define _80_CGC_OSCSTAB_STA8 (0x80U) /* 2^8/fX */
#define _C0_CGC_OSCSTAB_STA9 (0xC0U) /* 2^9/fX */
#define _E0_CGC_OSCSTAB_STA10 (0xE0U) /* 2^10/fX */
#define _F0_CGC_OSCSTAB_STA11 (0xF0U) /* 2^11/fX */
#define _F8_CGC_OSCSTAB_STA13 (0xF8U) /* 2^13/fX */
#define _FC_CGC_OSCSTAB_STA15 (0xFCU) /* 2^15/fX */
#define _FE_CGC_OSCSTAB_STA17 (0xFEU) /* 2^17/fX */
#define _FF_CGC_OSCSTAB_STA18 (0xFFU) /* 2^18/fX */
/*
Oscillation stabilization time select register (OSTS)
*/
/* Oscillation stabilization time selection (OSTS2 - OSTS0) */
#define _00_CGC_OSCSTAB_SEL8 (0x00U) /* 2^8/fX */
#define _01_CGC_OSCSTAB_SEL9 (0x01U) /* 2^9/fX */
#define _02_CGC_OSCSTAB_SEL10 (0x02U) /* 2^10/fX */
#define _03_CGC_OSCSTAB_SEL11 (0x03U) /* 2^11/fX */
#define _04_CGC_OSCSTAB_SEL13 (0x04U) /* 2^13/fX */
#define _05_CGC_OSCSTAB_SEL15 (0x05U) /* 2^15/fX */
#define _06_CGC_OSCSTAB_SEL17 (0x06U) /* 2^17/fX */
#define _07_CGC_OSCSTAB_SEL18 (0x07U) /* 2^18/fX */
/*
System clock control register (CKC)
*/
/* Status of Main system clock fMAIN (MCS) */
#define _00_CGC_MAINCLK_HIO (0x00U) /* high-speed OCO clock (fIH) */
#define _20_CGC_MAINCLK_HISYS (0x20U) /* high-speed system clock (fMX) */
/* Selection of Main system clock fMAIN (MCM0) */
#define _00_CGC_MAINCLK_SELHIO (0x00U) /* high-speed OCO clock (fIH) */
#define _10_CGC_MAINCLK_SELHISYS (0x10U) /* high-speed system clock (fMX) */
/*
Operation speed mode control register (OSMC)
*/
/* Interval timer unit input clock supply (WUTMMCK0) */
#define _00_CGC_IT_CLK_NO (0x00U) /* stop */
#define _10_CGC_IT_CLK_FIL (0x10U) /* use fIL clcok */
/*
Illegal memory access detection control register (IAWCTL)
*/
/* Illegal memory access detection control (IAWEN) */
#define _00_CGC_ILLEGAL_ACCESS_OFF (0x00U) /* disables illegal memory access detection */
#define _80_CGC_ILLEGAL_ACCESS_ON (0x80U) /* enables illegal memory access detection */
/* RAM guard area (GRAM1, GRAM0) */
#define _00_CGC_RAM_GUARD_OFF (0x00U) /* invalid, it is possible to write RAM */
#define _10_CGC_RAM_GUARD_ARAE0 (0x10U) /* 128 bytes from RAM bottom address */
#define _20_CGC_RAM_GUARD_ARAE1 (0x20U) /* 256 bytes from RAM bottom address */
#define _30_CGC_RAM_GUARD_ARAE2 (0x30U) /* 512 bytes from RAM bottom address */
/* PORT register guard (GPORT) */
#define _00_CGC_PORT_GUARD_OFF (0x00U) /* invalid, it is possible to write PORT register */
#define _04_CGC_PORT_GUARD_ON (0x04U) /* valid, it is impossible to write PORT register, but possible for read */
/* Interrupt register guard (GINT) */
#define _00_CGC_INT_GUARD_OFF (0x00U) /* invalid, it is possible to write interrupt register */
#define _02_CGC_INT_GUARD_ON (0x02U) /* valid, impossible to write interrupt register, but possible for read */
/* CSC register guard (GCSC) */
#define _00_CGC_CSC_GUARD_OFF (0x00U) /* invalid, it is possible to write CSC register */
#define _01_CGC_CSC_GUARD_ON (0x01U) /* valid, it is impossible to write CSC register, but possible for read */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef enum
{
HIOCLK,
SYSX1CLK,
SYSEXTCLK
} clock_mode_t;
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_CGC_Create(void);
void R_CGC_Get_ResetSource(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

64
bl_fc/r_cg_cgc_user.c Normal file
View File

@ -0,0 +1,64 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_cgc_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_CGC_Get_ResetSource
* Description : This function process of Reset.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CGC_Get_ResetSource(void)
{
uint8_t reset_flag = RESF;
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

88
bl_fc/r_cg_macrodriver.h Normal file
View File

@ -0,0 +1,88 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_macrodriver.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements general head file.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef STATUS_H
#define STATUS_H
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "iodefine.h"
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
#define DI __DI
#define EI __EI
#define HALT __halt
#define NOP __nop
#define STOP __stop
#define BRK __brk
/* Status list definition */
#define MD_STATUSBASE (0x00U)
#define MD_OK (MD_STATUSBASE + 0x00U) /* register setting OK */
#define MD_SPT (MD_STATUSBASE + 0x01U) /* IIC stop */
#define MD_NACK (MD_STATUSBASE + 0x02U) /* IIC no ACK */
#define MD_BUSY1 (MD_STATUSBASE + 0x03U) /* busy 1 */
#define MD_BUSY2 (MD_STATUSBASE + 0x04U) /* busy 2 */
#define MD_OVERRUN (MD_STATUSBASE + 0x05U) /* IIC OVERRUN occur */
/* Error list definition */
#define MD_ERRORBASE (0x80U)
#define MD_ERROR (MD_ERRORBASE + 0x00U) /* error */
#define MD_ARGERROR (MD_ERRORBASE + 0x01U) /* error agrument input error */
#define MD_ERROR1 (MD_ERRORBASE + 0x02U) /* error 1 */
#define MD_ERROR2 (MD_ERRORBASE + 0x03U) /* error 2 */
#define MD_ERROR3 (MD_ERRORBASE + 0x04U) /* error 3 */
#define MD_ERROR4 (MD_ERRORBASE + 0x05U) /* error 4 */
#endif
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef unsigned short MD_STATUS;
#define __TYPEDEF__
#endif
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
#endif

70
bl_fc/r_cg_port.c Normal file
View File

@ -0,0 +1,70 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_port.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_port.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_PORT_Create
* Description : This function initializes the Port I/O.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_PORT_Create(void)
{
P1 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0;
P2 = _00_Pn2_OUTPUT_0;
PMC1 = _00_PMCn0_DI_ON | _00_PMCn1_DI_ON | _00_PMCn2_DI_ON | _08_PMCn3_NOT_USE | _00_PMCn4_DI_ON | _E0_PMC1_DEFAULT;
PMC4 = _02_PMCn1_NOT_USE | _00_PMCn2_DI_ON | _F9_PMC4_DEFAULT;
ADPC = _01_ADPC_DI_ON;
PM1 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _04_PMn2_MODE_INPUT | _08_PMn3_NOT_USE | _10_PMn4_MODE_INPUT |
_E0_PM1_DEFAULT;
PM2 = _01_PMn0_MODE_INPUT | _02_PMn1_MODE_INPUT | _00_PMn2_MODE_OUTPUT | _08_PMn3_NOT_USE | _F0_PM2_DEFAULT;
PM4 = _01_PMn0_NOT_USE | _02_PMn1_NOT_USE | _04_PMn2_MODE_INPUT | _F8_PM4_DEFAULT;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

200
bl_fc/r_cg_port.h Normal file
View File

@ -0,0 +1,200 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_port.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef PORT_H
#define PORT_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Port Mode Register (PMm)
*/
/* Pmn pin I/O mode selection (PMm7 - PMm0) */
#define _01_PMn0_NOT_USE (0x01U) /* not use Pn0 as digital I/O */
#define _01_PMn0_MODE_INPUT (0x01U) /* use Pn0 as input mode */
#define _00_PMn0_MODE_OUTPUT (0x00U) /* use Pn0 as output mode */
#define _02_PMn1_NOT_USE (0x02U) /* not use Pn1 as digital I/O */
#define _02_PMn1_MODE_INPUT (0x02U) /* use Pn1 as input mode */
#define _00_PMn1_MODE_OUTPUT (0x00U) /* use Pn1 as output mode */
#define _04_PMn2_NOT_USE (0x04U) /* not use Pn2 as digital I/O */
#define _04_PMn2_MODE_INPUT (0x04U) /* use Pn2 as input mode */
#define _00_PMn2_MODE_OUTPUT (0x00U) /* use Pn2 as output mode */
#define _08_PMn3_NOT_USE (0x08U) /* not use Pn3 as digital I/O */
#define _08_PMn3_MODE_INPUT (0x08U) /* use Pn3 as input mode */
#define _00_PMn3_MODE_OUTPUT (0x00U) /* use Pn3 as output mode */
#define _10_PMn4_NOT_USE (0x10U) /* not use Pn4 as digital I/O */
#define _10_PMn4_MODE_INPUT (0x10U) /* use Pn4 as input mode */
#define _00_PMn4_MODE_OUTPUT (0x00U) /* use Pn4 as output mode */
#define _20_PMn5_NOT_USE (0x20U) /* not use Pn5 as digital I/O */
#define _20_PMn5_MODE_INPUT (0x20U) /* use Pn5 as input mode */
#define _00_PMn5_MODE_OUTPUT (0x00U) /* use Pn5 as output mode */
#define _40_PMn6_NOT_USE (0x40U) /* not use Pn6 as digital I/O */
#define _40_PMn6_MODE_INPUT (0x40U) /* use Pn6 as input mode */
#define _00_PMn6_MODE_OUTPUT (0x00U) /* use Pn6 as output mode */
#define _80_PMn7_NOT_USE (0x80U) /* not use Pn7 as digital I/O */
#define _80_PMn7_MODE_INPUT (0x80U) /* use Pn7 as input mode */
#define _00_PMn7_MODE_OUTPUT (0x00U) /* use Pn7 as output mode */
/*
Port Register (Pm)
*/
/* Pmn pin data (Pm0 to Pm7) */
#define _00_Pn0_OUTPUT_0 (0x00U) /* Pn0 output 0 */
#define _01_Pn0_OUTPUT_1 (0x01U) /* Pn0 output 1 */
#define _00_Pn1_OUTPUT_0 (0x00U) /* Pn1 output 0 */
#define _02_Pn1_OUTPUT_1 (0x02U) /* Pn1 output 1 */
#define _00_Pn2_OUTPUT_0 (0x00U) /* Pn2 output 0 */
#define _04_Pn2_OUTPUT_1 (0x04U) /* Pn2 output 1 */
#define _00_Pn3_OUTPUT_0 (0x00U) /* Pn3 output 0 */
#define _08_Pn3_OUTPUT_1 (0x08U) /* Pn3 output 1 */
#define _00_Pn4_OUTPUT_0 (0x00U) /* Pn4 output 0 */
#define _10_Pn4_OUTPUT_1 (0x10U) /* Pn4 output 1 */
#define _00_Pn5_OUTPUT_0 (0x00U) /* Pn5 output 0 */
#define _20_Pn5_OUTPUT_1 (0x20U) /* Pn5 output 1 */
#define _00_Pn6_OUTPUT_0 (0x00U) /* Pn6 output 0 */
#define _40_Pn6_OUTPUT_1 (0x40U) /* Pn6 output 1 */
#define _00_Pn7_OUTPUT_0 (0x00U) /* Pn7 output 0 */
#define _80_Pn7_OUTPUT_1 (0x80U) /* Pn7 output 1 */
/*
Pull-up Resistor Option Register (PUm)
*/
/* Pmn pin on-chip pull-up resistor selection (PUmn) */
#define _00_PUn0_PULLUP_OFF (0x00U) /* Pn0 pull-up resistor not connected */
#define _01_PUn0_PULLUP_ON (0x01U) /* Pn0 pull-up resistor connected */
#define _00_PUn1_PULLUP_OFF (0x00U) /* Pn1 pull-up resistor not connected */
#define _02_PUn1_PULLUP_ON (0x02U) /* Pn1 pull-up resistor connected */
#define _00_PUn2_PULLUP_OFF (0x00U) /* Pn2 Pull-up resistor not connected */
#define _04_PUn2_PULLUP_ON (0x04U) /* Pn2 pull-up resistor connected */
#define _00_PUn3_PULLUP_OFF (0x00U) /* Pn3 pull-up resistor not connected */
#define _08_PUn3_PULLUP_ON (0x08U) /* Pn3 pull-up resistor connected */
#define _00_PUn4_PULLUP_OFF (0x00U) /* Pn4 pull-up resistor not connected */
#define _10_PUn4_PULLUP_ON (0x10U) /* Pn4 pull-up resistor connected */
#define _00_PUn5_PULLUP_OFF (0x00U) /* Pn5 pull-up resistor not connected */
#define _20_PUn5_PULLUP_ON (0x20U) /* Pn5 pull-up resistor connected */
#define _00_PUn6_PULLUP_OFF (0x00U) /* Pn6 pull-up resistor not connected */
#define _40_PUn6_PULLUP_ON (0x40U) /* Pn6 pull-up resistor connected */
#define _00_PUn7_PULLUP_OFF (0x00U) /* Pn7 pull-up resistor not connected */
#define _80_PUn7_PULLUP_ON (0x80U) /* Pn7 pull-up resistor connected */
/*
Port Input Mode Register (PIMm)
*/
/* Pmn pin input buffer selection (PIMmn) */
#define _00_PIMn0_TTL_OFF (0x00U) /* set Pn0 normal input buffer */
#define _01_PIMn0_TTL_ON (0x01U) /* set Pn0 TTL input buffer */
#define _00_PIMn1_TTL_OFF (0x00U) /* set Pn1 normal input buffer */
#define _02_PIMn1_TTL_ON (0x02U) /* set Pn1 TTL input buffer */
#define _00_PIMn2_TTL_OFF (0x00U) /* set Pn2 normal input buffer */
#define _04_PIMn2_TTL_ON (0x04U) /* set Pn2 TTL input buffer */
#define _00_PIMn3_TTL_OFF (0x00U) /* set Pn3 normal input buffer */
#define _08_PIMn3_TTL_ON (0x08U) /* set Pn3 TTL input buffer */
#define _00_PIMn4_TTL_OFF (0x00U) /* set Pn4 normal input buffer */
#define _10_PIMn4_TTL_ON (0x10U) /* set Pn4 TTL input buffer */
#define _00_PIMn5_TTL_OFF (0x00U) /* set Pn5 normal input buffer */
#define _20_PIMn5_TTL_ON (0x20U) /* set Pn5 TTL input buffer */
#define _00_PIMn6_TTL_OFF (0x00U) /* set Pn6 normal input buffer */
#define _40_PIMn6_TTL_ON (0x40U) /* set Pn6 TTL input buffer */
#define _00_PIMn7_TTL_OFF (0x00U) /* set Pn7 normal input buffer */
#define _80_PIMn7_TTL_ON (0x80U) /* set Pn7 TTL input buffer */
/*
Port Output Mode Register (POMm)
*/
/* Pmn pin output mode selection (POMmn) */
#define _00_POMn0_NCH_OFF (0x00U) /* set Pn0 output normal mode */
#define _01_POMn0_NCH_ON (0x01U) /* set Pn0 output N-ch open-drain mode */
#define _00_POMn1_NCH_OFF (0x00U) /* set Pn1 output normal mode */
#define _02_POMn1_NCH_ON (0x02U) /* set Pn1 output N-ch open-drain mode */
#define _00_POMn2_NCH_OFF (0x00U) /* set Pn2 output normal mode */
#define _04_POMn2_NCH_ON (0x04U) /* set Pn2 output N-ch open-drain mode */
#define _00_POMn3_NCH_OFF (0x00U) /* set Pn3 output normal mode */
#define _08_POMn3_NCH_ON (0x08U) /* set Pn3 output N-ch open-drain mode */
#define _00_POMn4_NCH_OFF (0x00U) /* set Pn4 output normal mode */
#define _10_POMn4_NCH_ON (0x10U) /* set Pn4 output N-ch open-drain mode */
#define _00_POMn5_NCH_OFF (0x00U) /* set Pn5 output normal mode */
#define _20_POMn5_NCH_ON (0x20U) /* set Pn5 output N-ch open-drain mode */
#define _00_POMn6_NCH_OFF (0x00U) /* set Pn6 output normal mode */
#define _40_POMn6_NCH_ON (0x40U) /* set Pn6 output N-ch open-drain mode */
#define _00_POMn7_NCH_OFF (0x00U) /* set Pn7 output normal mode */
#define _80_POMn7_NCH_ON (0x80U) /* set Pn7 output N-ch open-drain mode */
/*
Port Operation Mode Register (PMCm)
*/
/* Pmn pin digital input buffer selection (PMCmn) */
#define _01_PMCn0_NOT_USE (0x01U) /* not use Pn0 digital input */
#define _00_PMCn0_DI_ON (0x00U) /* enable Pn0 digital input */
#define _02_PMCn1_NOT_USE (0x02U) /* not use Pn1 digital input */
#define _00_PMCn1_DI_ON (0x00U) /* enable Pn1 digital input */
#define _04_PMCn2_NOT_USE (0x04U) /* not use Pn2 digital input */
#define _00_PMCn2_DI_ON (0x00U) /* enable Pn2 digital input */
#define _08_PMCn3_NOT_USE (0x08U) /* not use Pn3 digital input */
#define _00_PMCn3_DI_ON (0x00U) /* enable Pn3 digital input */
#define _10_PMCn4_NOT_USE (0x10U) /* not use Pn4 digital input */
#define _00_PMCn4_DI_ON (0x00U) /* enable Pn4 digital input */
#define _20_PMCn5_NOT_USE (0x20U) /* not use Pn5 digital input */
#define _00_PMCn5_DI_ON (0x00U) /* enable Pn5 digital input */
#define _40_PMCn6_NOT_USE (0x40U) /* not use Pn6 digital input */
#define _00_PMCn6_DI_ON (0x00U) /* enable Pn6 digital input */
#define _80_PMCn7_NOT_USE (0x80U) /* not use Pn7 digital input */
#define _00_PMCn7_DI_ON (0x00U) /* enable Pn7 digital input */
/*
AD port configuration register (ADPC)
*/
/* Analog input/digital input switching (ADPC3 - ADPC0) */
#define _00_ADPC_DI_OFF (0x00U) /* use P20 - P23 as analog input */
#define _04_ADPC_DI_ON (0x04U) /* use P23 as digital input */
#define _03_ADPC_DI_ON (0x03U) /* use P22 - P23 as digital input */
#define _02_ADPC_DI_ON (0x02U) /* use P21 - P23 as digital input */
#define _01_ADPC_DI_ON (0x01U) /* use P20 - P23 as digital input */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#define _E0_PM1_DEFAULT (0xE0U) /* PM1 default value */
#define _F0_PM2_DEFAULT (0xF0U) /* PM2 default value */
#define _F8_PM4_DEFAULT (0xF8U) /* PM4 default value */
#define _FC_PM6_DEFAULT (0xFCU) /* PM6 default value */
#define _E0_PMC1_DEFAULT (0xE0U) /* PMC1 default value */
#define _F9_PMC4_DEFAULT (0xF9U) /* PMC4 default value */
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_PORT_Create(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

51
bl_fc/r_cg_port_user.c Normal file
View File

@ -0,0 +1,51 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_port_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_port.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

158
bl_fc/r_cg_timer.c Normal file
View File

@ -0,0 +1,158 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_TAU0_Create
* Description : This function initializes the TAU0 module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Create(void)
{
TAU0EN = 1U; /* supplies input clock */
TPS0 = _0000_TAU_CKM0_FCLK_0 | _0000_TAU_CKM1_FCLK_0 | _0000_TAU_CKM2_FCLK_1 | _0000_TAU_CKM3_FCLK_8;
/* Stop all channels */
TT0 = _0001_TAU_CH0_STOP_TRG_ON | _0002_TAU_CH1_STOP_TRG_ON | _0004_TAU_CH2_STOP_TRG_ON |
_0008_TAU_CH3_STOP_TRG_ON | _0200_TAU_CH1_H8_STOP_TRG_ON | _0800_TAU_CH3_H8_STOP_TRG_ON;
/* Mask channel 0 interrupt */
TMMK00 = 1U; /* disable INTTM00 interrupt */
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
/* Mask channel 1 interrupt */
TMMK01 = 1U; /* disable INTTM01 interrupt */
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
/* Mask channel 1 higher 8 bits interrupt */
TMMK01H = 1U; /* disable INTTM01H interrupt */
TMIF01H = 0U; /* clear INTTM01H interrupt flag */
/* Mask channel 2 interrupt */
TMMK02 = 1U; /* disable INTTM02 interrupt */
TMIF02 = 0U; /* clear INTTM02 interrupt flag */
/* Mask channel 3 interrupt */
TMMK03 = 1U; /* disable INTTM03 interrupt */
TMIF03 = 0U; /* clear INTTM03 interrupt flag */
/* Mask channel 3 higher 8 bits interrupt */
TMMK03H = 1U; /* disable INTTM03H interrupt */
TMIF03H = 0U; /* clear INTTM03H interrupt flag */
/* Set INTTM00 low priority */
TMPR100 = 1U;
TMPR000 = 1U;
/* Set INTTM01 low priority */
TMPR101 = 1U;
TMPR001 = 1U;
/* Channel 0 used as interval timer */
TMR00 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE |
_0000_TAU_TRIGGER_SOFTWARE | _0000_TAU_MODE_INTERVAL_TIMER | _0000_TAU_START_INT_UNUSED;
TDR00 = _5DBF_TAU_TDR00_VALUE;
TO0 &= ~_0001_TAU_CH0_OUTPUT_VALUE_1;
TOE0 &= ~_0001_TAU_CH0_OUTPUT_ENABLE;
/* Channel 1 used as interval timer */
TMR01 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_16BITS_MODE |
_0000_TAU_TRIGGER_SOFTWARE | _0000_TAU_MODE_INTERVAL_TIMER | _0000_TAU_START_INT_UNUSED;
TDR01 = _BB7F_TAU_TDR01_VALUE;
TOM0 &= ~_0002_TAU_CH1_OUTPUT_COMBIN;
TOL0 &= ~_0002_TAU_CH1_OUTPUT_LEVEL_L;
TO0 &= ~_0002_TAU_CH1_OUTPUT_VALUE_1;
TOE0 &= ~_0002_TAU_CH1_OUTPUT_ENABLE;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel0_Start
* Description : This function starts TAU0 channel 0 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel0_Start(void)
{
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
TMMK00 = 0U; /* enable INTTM00 interrupt */
TS0 |= _0001_TAU_CH0_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel0_Stop
* Description : This function stops TAU0 channel 0 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel0_Stop(void)
{
TT0 |= _0001_TAU_CH0_STOP_TRG_ON;
/* Mask channel 0 interrupt */
TMMK00 = 1U; /* disable INTTM00 interrupt */
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel1_Start
* Description : This function starts TAU0 channel 1 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel1_Start(void)
{
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
TMMK01 = 0U; /* enable INTTM01 interrupt */
TS0 |= _0002_TAU_CH1_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel1_Stop
* Description : This function stops TAU0 channel 1 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel1_Stop(void)
{
TT0 |= _0002_TAU_CH1_STOP_TRG_ON;
/* Mask channel 1 interrupt */
TMMK01 = 1U; /* disable INTTM01 interrupt */
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

321
bl_fc/r_cg_timer.h Normal file
View File

@ -0,0 +1,321 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef TAU_H
#define TAU_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Peripheral Enable Register 0 (PER0)
*/
/* Control of timer array unit 0 input clock (TAU0EN) */
#define _00_TAU0_CLOCK_STOP (0x00U) /* stops supply of input clock */
#define _01_TAU0_CLOCK_SUPPLY (0x01U) /* supplies input clock */
/*
Timer Clock Select Register m (TPSm)
*/
/* Operating mode and clear mode selection (PRSm03 - PRSm00) */
#define _0000_TAU_CKM0_FCLK_0 (0x0000U) /* ckm0 - fCLK */
#define _0001_TAU_CKM0_FCLK_1 (0x0001U) /* ckm0 - fCLK/2^1 */
#define _0002_TAU_CKM0_FCLK_2 (0x0002U) /* ckm0 - fCLK/2^2 */
#define _0003_TAU_CKM0_FCLK_3 (0x0003U) /* ckm0 - fCLK/2^3 */
#define _0004_TAU_CKM0_FCLK_4 (0x0004U) /* ckm0 - fCLK/2^4 */
#define _0005_TAU_CKM0_FCLK_5 (0x0005U) /* ckm0 - fCLK/2^5 */
#define _0006_TAU_CKM0_FCLK_6 (0x0006U) /* ckm0 - fCLK/2^6 */
#define _0007_TAU_CKM0_FCLK_7 (0x0007U) /* ckm0 - fCLK/2^7 */
#define _0008_TAU_CKM0_FCLK_8 (0x0008U) /* ckm0 - fCLK/2^8 */
#define _0009_TAU_CKM0_FCLK_9 (0x0009U) /* ckm0 - fCLK/2^9 */
#define _000A_TAU_CKM0_FCLK_10 (0x000AU) /* ckm0 - fCLK/2^10 */
#define _000B_TAU_CKM0_FCLK_11 (0x000BU) /* ckm0 - fCLK/2^11 */
#define _000C_TAU_CKM0_FCLK_12 (0x000CU) /* ckm0 - fCLK/2^12 */
#define _000D_TAU_CKM0_FCLK_13 (0x000DU) /* ckm0 - fCLK/2^13 */
#define _000E_TAU_CKM0_FCLK_14 (0x000EU) /* ckm0 - fCLK/2^14 */
#define _000F_TAU_CKM0_FCLK_15 (0x000FU) /* ckm0 - fCLK/2^15 */
/* Operating mode and clear mode selection (PRSm13 - PRSm10) */
#define _0000_TAU_CKM1_FCLK_0 (0x0000U) /* ckm1 - fCLK */
#define _0010_TAU_CKM1_FCLK_1 (0x0010U) /* ckm1 - fCLK/2^1 */
#define _0020_TAU_CKM1_FCLK_2 (0x0020U) /* ckm1 - fCLK/2^2 */
#define _0030_TAU_CKM1_FCLK_3 (0x0030U) /* ckm1 - fCLK/2^3 */
#define _0040_TAU_CKM1_FCLK_4 (0x0040U) /* ckm1 - fCLK/2^4 */
#define _0050_TAU_CKM1_FCLK_5 (0x0050U) /* ckm1 - fCLK/2^5 */
#define _0060_TAU_CKM1_FCLK_6 (0x0060U) /* ckm1 - fCLK/2^6 */
#define _0070_TAU_CKM1_FCLK_7 (0x0070U) /* ckm1 - fCLK/2^7 */
#define _0080_TAU_CKM1_FCLK_8 (0x0080U) /* ckm1 - fCLK/2^8 */
#define _0090_TAU_CKM1_FCLK_9 (0x0090U) /* ckm1 - fCLK/2^9 */
#define _00A0_TAU_CKM1_FCLK_10 (0x00A0U) /* ckm1 - fCLK/2^10 */
#define _00B0_TAU_CKM1_FCLK_11 (0x00B0U) /* ckm1 - fCLK/2^11 */
#define _00C0_TAU_CKM1_FCLK_12 (0x00C0U) /* ckm1 - fCLK/2^12 */
#define _00D0_TAU_CKM1_FCLK_13 (0x00D0U) /* ckm1 - fCLK/2^13 */
#define _00E0_TAU_CKM1_FCLK_14 (0x00E0U) /* ckm1 - fCLK/2^14 */
#define _00F0_TAU_CKM1_FCLK_15 (0x00F0U) /* ckm1 - fCLK/2^15 */
/* Operating mode and clear mode selection (PRSm21 - PRSm20) */
#define _0000_TAU_CKM2_FCLK_1 (0x0000U) /* ckm2 - fCLK/2^1 */
#define _0100_TAU_CKM2_FCLK_2 (0x0100U) /* ckm2 - fCLK/2^2 */
#define _0200_TAU_CKM2_FCLK_4 (0x0200U) /* ckm2 - fCLK/2^4 */
#define _0300_TAU_CKM2_FCLK_6 (0x0300U) /* ckm2 - fCLK/2^6 */
/* Operating mode and clear mode selection (PRSm31 - PRSm30) */
#define _0000_TAU_CKM3_FCLK_8 (0x0000U) /* ckm2 - fCLK/2^8 */
#define _1000_TAU_CKM3_FCLK_10 (0x1000U) /* ckm2 - fCLK/2^10 */
#define _2000_TAU_CKM3_FCLK_12 (0x2000U) /* ckm2 - fCLK/2^12 */
#define _3000_TAU_CKM3_FCLK_14 (0x3000U) /* ckm2 - fCLK/2^14 */
/*
Timer Mode Register mn (TMRmn)
*/
/* Selection of macro clock (MCK) of channel n (CKSmn1 - CKSmn0) */
#define _0000_TAU_CLOCK_SELECT_CKM0 (0x0000U) /* operation clock CK0 set by PRS register */
#define _8000_TAU_CLOCK_SELECT_CKM1 (0x8000U) /* operation clock CK1 set by PRS register */
#define _4000_TAU_CLOCK_SELECT_CKM2 (0x4000U) /* operation clock CK2 set by PRS register */
#define _C000_TAU_CLOCK_SELECT_CKM3 (0xC000U) /* operation clock CK3 set by PRS register */
/* Selection of count clock (CCK) of channel n (CCSmn) */
#define _0000_TAU_CLOCK_MODE_CKS (0x0000U) /* macro clock MCK specified by CKSmn bit */
#define _1000_TAU_CLOCK_MODE_TIMN (0x1000U) /* valid edge of input signal input from TImn pin */
/* Selection of slave/master of channel n (MASTERmn) */
#define _0000_TAU_COMBINATION_SLAVE (0x0000U) /* operates as slave channel */
#define _0000_TAU_COMBINATION_MASTER (0x0000U) /* channel0 operates as master channel */
#define _0800_TAU_COMBINATION_MASTER (0x0800U) /* channel2, 4, 6 operates as master channel */
/* Operation explanation of channel 1 or 3 (SPLIT) */
#define _0000_TAU_16BITS_MODE (0x0000U) /* operates as 16 bits timer */
#define _0800_TAU_8BITS_MODE (0x0800U) /* operates as 8 bits timer */
/* Setting of start trigger or capture trigger of channel n (STSmn2 - STSmn0) */
#define _0000_TAU_TRIGGER_SOFTWARE (0x0000U) /* only software trigger start is valid */
#define _0100_TAU_TRIGGER_TIMN_VALID (0x0100U) /* TImn input edge is used as a start/capture trigger */
#define _0200_TAU_TRIGGER_TIMN_BOTH (0x0200U) /* TImn input edges are used as a start/capture trigger */
#define _0400_TAU_TRIGGER_MASTER_INT (0x0400U) /* interrupt signal of the master channel is used */
/* Selection of TImn pin input valid edge (CISmn1 - CISmn0) */
#define _0000_TAU_TIMN_EDGE_FALLING (0x0000U) /* falling edge */
#define _0040_TAU_TIMN_EDGE_RISING (0x0040U) /* rising edge */
#define _0080_TAU_TIMN_EDGE_BOTH_LOW (0x0080U) /* both edges (when low-level width is measured) */
#define _00C0_TAU_TIMN_EDGE_BOTH_HIGH (0x00C0U) /* both edges (when high-level width is measured) */
/* Operation mode of channel n (MDmn3 - MDmn0) */
#define _0000_TAU_MODE_INTERVAL_TIMER (0x0000U) /* interval timer mode */
#define _0004_TAU_MODE_CAPTURE (0x0004U) /* capture mode */
#define _0006_TAU_MODE_EVENT_COUNT (0x0006U) /* event counter mode */
#define _0008_TAU_MODE_ONE_COUNT (0x0008U) /* one count mode */
#define _000C_TAU_MODE_HIGHLOW_MEASURE (0x000CU) /* high-/low-level width measurement mode */
#define _0001_TAU_MODE_PWM_MASTER (0x0001U) /* PWM Function (Master Channel) mode */
#define _0009_TAU_MODE_PWM_SLAVE (0x0009U) /* PWM Function (Slave Channel) mode */
#define _0008_TAU_MODE_ONESHOT (0x0008U) /* one-shot pulse output mode */
/* Setting of starting counting and interrupt (MDmn0) */
#define _0000_TAU_START_INT_UNUSED (0x0000U) /* interrupt is not generated when counting is started */
#define _0001_TAU_START_INT_USED (0x0001U) /* interrupt is generated when counting is started */
/*
Timer Status Register mn (TSRmn)
*/
/* Counter overflow status of channel n (OVF) */
#define _0000_TAU_OVERFLOW_NOT_OCCURS (0x0000U) /* overflow does not occur */
#define _0001_TAU_OVERFLOW_OCCURS (0x0001U) /* overflow occurs */
/*
Timer Channel Enable Status Register m (TEm)
*/
/* Indication of operation enable/stop status of channel 0 (TEm0) */
#define _0000_TAU_CH0_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0001_TAU_CH0_OPERATION_ENABLE (0x0001U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 1 (TEm1) */
#define _0000_TAU_CH1_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0002_TAU_CH1_OPERATION_ENABLE (0x0002U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 2 (TEm2) */
#define _0000_TAU_CH2_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0004_TAU_CH2_OPERATION_ENABLE (0x0004U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 3 (TEm3) */
#define _0000_TAU_CH3_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0008_TAU_CH3_OPERATION_ENABLE (0x0008U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 1 higher 8 bits (TEHm1) */
#define _0000_TAU_CH1_H8_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0200_TAU_CH1_H8_OPERATION_ENABLE (0x0200U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 3 higher 8 bits (TEHm3) */
#define _0000_TAU_CH3_H8_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0800_TAU_CH3_H8_OPERATION_ENABLE (0x0800U) /* operation is enabled */
/*
Timer Channel Start Register m (TSm)
*/
/* Operation enable (start) trigger of channel 0 (TSm0) */
#define _0000_TAU_CH0_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0001_TAU_CH0_START_TRG_ON (0x0001U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 1 (TSm1) */
#define _0000_TAU_CH1_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0002_TAU_CH1_START_TRG_ON (0x0002U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 2 (TSm2) */
#define _0000_TAU_CH2_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0004_TAU_CH2_START_TRG_ON (0x0004U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 3 (TSm3) */
#define _0000_TAU_CH3_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0008_TAU_CH3_START_TRG_ON (0x0008U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 1 higher 8 bits (TSHm1) */
#define _0000_TAU_CH1_H8_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0200_TAU_CH1_H8_START_TRG_ON (0x0200U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 3 higher 8 bits (TSHm3) */
#define _0000_TAU_CH3_H8_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0800_TAU_CH3_H8_START_TRG_ON (0x0800U) /* operation is enabled (start trigger is generated) */
/*
Timer Channel Stop Register m (TTm)
*/
/* Operation stop trigger of channel 0 (TTm0) */
#define _0000_TAU_CH0_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0001_TAU_CH0_STOP_TRG_ON (0x0001U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 1 (TTm1) */
#define _0000_TAU_CH1_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0002_TAU_CH1_STOP_TRG_ON (0x0002U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 2 (TTm2) */
#define _0000_TAU_CH2_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0004_TAU_CH2_STOP_TRG_ON (0x0004U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 3 (TTm3) */
#define _0000_TAU_CH3_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0008_TAU_CH3_STOP_TRG_ON (0x0008U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 1 higher 8 bits (TTHm1) */
#define _0000_TAU_CH1_H8_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0200_TAU_CH1_H8_STOP_TRG_ON (0x0200U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 3 higher 8 bits (TTHm3) */
#define _0000_TAU_CH3_H8_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0800_TAU_CH3_H8_STOP_TRG_ON (0x0800U) /* operation is stopped (stop trigger is generated) */
/*
Timer Input Select Register m (TIS0)
*/
/* Selection of timer input used with channel 1 (TIS01 - TIS00) */
#define _00_TAU_CH1_INPUT_TI01 (0x00U) /* input signal of timer input pin (TI01) */
#define _01_TAU_CH1_INPUT_FIL (0x01U) /* internal low speed oscillation colock (fIL) */
#define _10_TAU_CH1_INPUT_TI01 (0x10U) /* input signal of timer input pin (TI01) */
/*
Timer Output Enable Register m (TOEm)
*/
/* Timer output enable/disable of channel 0 (TOEm0) */
#define _0001_TAU_CH0_OUTPUT_ENABLE (0x0001U) /* the TOm0 operation enabled by count operation */
#define _0000_TAU_CH0_OUTPUT_DISABLE (0x0000U) /* the TOm0 operation stopped by count operation */
/* Timer output enable/disable of channel 1 (TOEm1) */
#define _0002_TAU_CH1_OUTPUT_ENABLE (0x0002U) /* the TOm1 operation enabled by count operation */
#define _0000_TAU_CH1_OUTPUT_DISABLE (0x0000U) /* the TOm1 operation stopped by count operation */
/* Timer output enable/disable of channel 2 (TOEm2) */
#define _0004_TAU_CH2_OUTPUT_ENABLE (0x0004U) /* the TOm2 operation enabled by count operation */
#define _0000_TAU_CH2_OUTPUT_DISABLE (0x0000U) /* the TOm2 operation stopped by count operation */
/* Timer output enable/disable of channel 3 (TOEm3) */
#define _0008_TAU_CH3_OUTPUT_ENABLE (0x0008U) /* the TOm3 operation enabled by count operation */
#define _0000_TAU_CH3_OUTPUT_DISABLE (0x0000U) /* the TOm3 operation stopped by count operation */
/*
Timer Output Register m (TOm)
*/
/* Timer output of channel 0 (TOm0) */
#define _0000_TAU_CH0_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0001_TAU_CH0_OUTPUT_VALUE_1 (0x0001U) /* timer output value is "1" */
/* Timer output of channel 1 (TOm1) */
#define _0000_TAU_CH1_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0002_TAU_CH1_OUTPUT_VALUE_1 (0x0002U) /* timer output value is "1" */
/* Timer output of channel 2 (TOm2) */
#define _0000_TAU_CH2_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0004_TAU_CH2_OUTPUT_VALUE_1 (0x0004U) /* timer output value is "1" */
/* Timer output of channel 3 (TOm3) */
#define _0000_TAU_CH3_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0008_TAU_CH3_OUTPUT_VALUE_1 (0x0008U) /* timer output value is "1" */
/*
Timer Output Level Register 0 (TOLm)
*/
/* Control of timer output level of channel 1 (TOLm1) */
#define _0000_TAU_CH1_OUTPUT_LEVEL_H (0x0000U) /* positive logic output (active-high) */
#define _0002_TAU_CH1_OUTPUT_LEVEL_L (0x0002U) /* inverted output (active-low) */
/* Control of timer output level of channel 2 (TOLm2) */
#define _0000_TAU_CH2_OUTPUT_LEVEL_H (0x0000U) /* positive logic output (active-high) */
#define _0004_TAU_CH2_OUTPUT_LEVEL_L (0x0004U) /* inverted output (active-low) */
/* Control of timer output level of channel 3 (TOLm3) */
#define _0000_TAU_CH3_OUTPUT_LEVEL_H (0x0000U) /* positive logic output (active-high) */
#define _0008_TAU_CH3_OUTPUT_LEVEL_L (0x0008U) /* inverted output (active-low) */
/*
Timer Output Mode Register m (TOMm)
*/
/* Control of timer output mode of channel 1 (TOMm1) */
#define _0000_TAU_CH1_OUTPUT_TOGGLE (0x0000U) /* toggle operation mode */
#define _0002_TAU_CH1_OUTPUT_COMBIN (0x0002U) /* combination operation mode */
/* Control of timer output mode of channel 2 (TOMm2) */
#define _0000_TAU_CH2_OUTPUT_TOGGLE (0x0000U) /* toggle operation mode */
#define _0004_TAU_CH2_OUTPUT_COMBIN (0x0004U) /* combination operation mode */
/* Control of timer output mode of channel 3 (TOMm3) */
#define _0000_TAU_CH3_OUTPUT_TOGGLE (0x0000U) /* toggle operation mode */
#define _0008_TAU_CH3_OUTPUT_COMBIN (0x0008U) /* combination operation mode */
/*
Input Switch Control Register (ISC)
*/
/* Switching channel 7 input of timer array unit (ISC1) */
#define _00_TAU_CH7_NO_INPUT (0x00U) /* timer input is not used */
#define _02_TAU_CH7_RXD3_INPUT (0x02U) /* input signal of RxD3 pin is used as timer input */
/*
Noise Filter Enable Register 1 (NFEN1)
*/
/* Enable/disable using noise filter of TI03 pin input signal (TNFEN03) */
#define _00_TAU_CH3_NOISE_OFF (0x00U) /* noise filter OFF */
#define _08_TAU_CH3_NOISE_ON (0x08U) /* noise filter ON */
/* Enable/disable using noise filter of TI02 pin input signal (TNFEN02) */
#define _00_TAU_CH2_NOISE_OFF (0x00U) /* noise filter OFF */
#define _04_TAU_CH2_NOISE_ON (0x04U) /* noise filter ON */
/* Enable/disable using noise filter of TI01 pin input signal (TNFEN01) */
#define _00_TAU_CH1_NOISE_OFF (0x00U) /* noise filter OFF */
#define _02_TAU_CH1_NOISE_ON (0x02U) /* noise filter ON */
/* Enable/disable using noise filter of TI00 pin input signal (TNFEN00) */
#define _00_TAU_CH0_NOISE_OFF (0x00U) /* noise filter OFF */
#define _01_TAU_CH0_NOISE_ON (0x01U) /* noise filter ON */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/* 16-bit timer data register 00 (TDR00) */
#define _5DBF_TAU_TDR00_VALUE (0x5DBFU)
/* Clock divisor for TAU0 channel 0 */
#define _0001_TAU0_CHANNEL0_DIVISOR (0x0001U)
/* 16-bit timer data register 01 (TDR01) */
#define _BB7F_TAU_TDR01_VALUE (0xBB7FU)
/* Clock divisor for TAU0 channel 1 */
#define _0001_TAU0_CHANNEL1_DIVISOR (0x0001U)
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_TAU0_Create(void);
void R_TAU0_Channel0_Start(void);
void R_TAU0_Channel0_Stop(void);
void R_TAU0_Channel1_Start(void);
void R_TAU0_Channel1_Stop(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

79
bl_fc/r_cg_timer_user.c Normal file
View File

@ -0,0 +1,79 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
#include "event.h"
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_tau0_channel0_interrupt(vect=INTTM00)
#pragma interrupt r_tau0_channel1_interrupt(vect=INTTM01)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_tau0_channel0_interrupt
* Description : This function is INTTM00 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_tau0_channel0_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
TimeBaseCount();
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: r_tau0_channel1_interrupt
* Description : This function is INTTM01 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_tau0_channel1_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

38
bl_fc/r_cg_userdefine.h Normal file
View File

@ -0,0 +1,38 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_userdefine.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file includes user definition.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef _USER_DEF_H
#define _USER_DEF_H
/***********************************************************************************************************************
User definitions
***********************************************************************************************************************/
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

78
bl_fc/r_cg_wdt.c Normal file
View File

@ -0,0 +1,78 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_wdt.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_WDT_Create
* Description : This function initializes the watchdogtimer.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_WDT_Create(void)
{
WDTIMK = 1U; /* disable INTWDTI interrupt */
WDTIIF = 0U; /* clear INTWDTI interrupt flag */
/* Set INTWDTI low priority */
WDTIPR1 = 1U;
WDTIPR0 = 1U;
WDTIMK = 0U; /* enable INTWDTI interrupt */
}
/***********************************************************************************************************************
* Function Name: R_WDT_Restart
* Description : This function restarts the watchdog timer.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_WDT_Restart(void)
{
WDTE = 0xACU; /* restart watchdog timer */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

52
bl_fc/r_cg_wdt.h Normal file
View File

@ -0,0 +1,52 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_wdt.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
#ifndef WDT_H
#define WDT_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_WDT_Create(void);
void R_WDT_Restart(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

64
bl_fc/r_cg_wdt_user.c Normal file
View File

@ -0,0 +1,64 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_wdt_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_wdt_interrupt(vect=INTWDTI)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_wdt_interrupt
* Description : This function is INTWDTI interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_wdt_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

90
bl_fc/r_main.c Normal file
View File

@ -0,0 +1,90 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_main.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements main function.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_adc.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
#include "appTask.h"
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
void R_MAIN_UserInit(void);
/***********************************************************************************************************************
* Function Name: main
* Description : This function implements main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void main(void)
{
R_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
HardWare_Init();
Variable_Init();
while (1U)
{
AppTask();
}
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: R_MAIN_UserInit
* Description : This function adds user code before implementing main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_MAIN_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
EI();
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

86
bl_fc/r_systeminit.c Normal file
View File

@ -0,0 +1,86 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_systeminit.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements system initializing function.
* Creation Date: 2022/5/18
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_adc.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description : This function initializes every macro.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
PIOR = 0x00U;
R_CGC_Get_ResetSource();
R_CGC_Create();
R_PORT_Create();
R_ADC_Create();
R_TAU0_Create();
R_WDT_Create();
IAWCTL = 0x00U;
}
/***********************************************************************************************************************
* Function Name: hdwinit
* Description : This function initializes hardware setting.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void hdwinit(void)
{
DI();
R_Systeminit();
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

77
bl_fc/stkinit.asm Normal file
View File

@ -0,0 +1,77 @@
;/**********************************************************************************************************************
; * DISCLAIMER
; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
; * applicable laws, including copyright laws.
; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO
; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
; * this software. By using this software, you agree to the additional terms and conditions found by accessing the
; * following link:
; * http://www.renesas.com/disclaimer
; *
; * Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
; *********************************************************************************************************************/;---------------------------------------------------------------------
; _stkinit
;
; void _stkinit(void __near * stackbss);
;
; input:
; stackbss = AX (#LOWW(_stackend))
; output:
; NONE
;---------------------------------------------------------------------
; NOTE : THIS IS A TYPICAL EXAMPLE.
.PUBLIC _stkinit
.textf .CSEG TEXTF
_stkinit:
MOVW HL,AX ; stack_end_addr
MOV [SP+3],#0x00 ; [SP+0]-[SP+2] for return address
MOVW AX,SP
SUBW AX,HL ; SUBW AX,#LOWW _@STEND
BNH $LSTINIT3 ; goto end
SHRW AX,5 ; loop count for 32 byte transfer
MOVW BC,AX
CLRW AX
LSTINIT1:
CMPW AX,BC
BZ $LSTINIT2
MOVW [HL],AX
MOVW [HL+2],AX
MOVW [HL+4],AX
MOVW [HL+6],AX
MOVW [HL+8],AX
MOVW [HL+10],AX
MOVW [HL+12],AX
MOVW [HL+14],AX
MOVW [HL+16],AX
MOVW [HL+18],AX
MOVW [HL+20],AX
MOVW [HL+22],AX
MOVW [HL+24],AX
MOVW [HL+26],AX
MOVW [HL+28],AX
MOVW [HL+30],AX
XCHW AX,HL
ADDW AX,#0x20
XCHW AX,HL
DECW BC
BR $LSTINIT1
LSTINIT2:
MOVW AX,SP
CMPW AX,HL
BZ $LSTINIT3 ; goto end
CLRW AX
MOVW [HL],AX
INCW HL
INCW HL
BR $LSTINIT2
LSTINIT3:
RET

20
bl_zc/.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"__near="
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}

27
bl_zc/.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"files.associations": {
"event.h": "c",
"apptask.h": "c",
"hwctrl.h": "c",
"r_cg_macrodriver.h": "c",
"iodefine.h": "c"
},
"MicroPython.executeButton": [
{
"text": "▶",
"tooltip": "运行",
"alignment": "left",
"command": "extension.executeFile",
"priority": 3.5
}
],
"MicroPython.syncButton": [
{
"text": "$(sync)",
"tooltip": "同步",
"alignment": "left",
"command": "extension.execute",
"priority": 4
}
]
}

View File

@ -0,0 +1,293 @@
QualityReport
2025年1月17日 15:33:15
------ Start build(bl, DefaultBuild) ------
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe appTask.c -cpu=S2 -o DefaultBuild\appTask.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_port_user.c -cpu=S2 -o DefaultBuild\r_cg_port_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_cgc_user.c -cpu=S2 -o DefaultBuild\r_cg_cgc_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_adc_user.c -cpu=S2 -o DefaultBuild\r_cg_adc_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe hwCtrl.c -cpu=S2 -o DefaultBuild\hwCtrl.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_systeminit.c -cpu=S2 -o DefaultBuild\r_systeminit.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_timer_user.c -cpu=S2 -o DefaultBuild\r_cg_timer_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_wdt_user.c -cpu=S2 -o DefaultBuild\r_cg_wdt_user.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
hwCtrl.c(62):W0520111:Statement is unreachable
hwCtrl.c(65):W0520111:Statement is unreachable
hwCtrl.c(68):W0520111:Statement is unreachable
hwCtrl.c(71):W0520111:Statement is unreachable
appTask.c(30):W0523077:Called function should have prototype
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_cgc.c -cpu=S2 -o DefaultBuild\r_cg_cgc.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_main.c -cpu=S2 -o DefaultBuild\r_main.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
appTask.c(31):W0523077:Called function should have prototype
appTask.c(268):W0520177:Variable "ledno" was declared but never referenced
appTask.c(268):W0520177:Variable "last" was declared but never referenced
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe cstart.asm -cpu=S2 -o DefaultBuild\cstart.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_adc.c -cpu=S2 -o DefaultBuild\r_cg_adc.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_timer.c -cpu=S2 -o DefaultBuild\r_cg_timer.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_port.c -cpu=S2 -o DefaultBuild\r_cg_port.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe r_cg_wdt.c -cpu=S2 -o DefaultBuild\r_cg_wdt.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe event.c -cpu=S2 -o DefaultBuild\event.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -g_line -I . -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\ccrl.exe stkinit.asm -cpu=S2 -o DefaultBuild\stkinit.obj "-dev=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF" -g -c -msg_lang=english
E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\Bin\rlink.exe -subcommand=DefaultBuild\bl.clnk
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
W0561017:The evaluation period of CC-RL V1 has expired. Please consider purchasing the product.
Renesas Optimizing Linker Completed
------ Build ended(Error:0, Warning:10)(bl, DefaultBuild) ------
--- CommandFile 1 ---
DefaultBuild\bl.clnk :
-Input=DefaultBuild\cstart.obj
-Input=DefaultBuild\stkinit.obj
-Input=DefaultBuild\r_main.obj
-Input=DefaultBuild\r_systeminit.obj
-Input=DefaultBuild\r_cg_cgc.obj
-Input=DefaultBuild\r_cg_cgc_user.obj
-Input=DefaultBuild\r_cg_port.obj
-Input=DefaultBuild\r_cg_port_user.obj
-Input=DefaultBuild\r_cg_adc.obj
-Input=DefaultBuild\r_cg_adc_user.obj
-Input=DefaultBuild\r_cg_timer.obj
-Input=DefaultBuild\r_cg_timer_user.obj
-Input=DefaultBuild\r_cg_wdt.obj
-Input=DefaultBuild\r_cg_wdt_user.obj
-Input=DefaultBuild\appTask.obj
-Input=DefaultBuild\event.obj
-Input=DefaultBuild\hwCtrl.obj
-SECURITY_ID=00000000000000000000
-DEVICE=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF
-DEBug
-NOCOmpress
-NOOPtimize
-OUtput=DefaultBuild\bl.abs
-LIBrary=E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\lib\rl78cm4s.lib
-LIBrary=E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\lib\malloc_n.lib
-LIBrary=E:\Program Files (x86)\renesas\CS+\CC\CC-RL\V1.11.00\lib\rl78cm4r.lib
-OCDBG=84
-DEBUG_MONITOR=1E00-1FFF
-USER_OPT_BYTE=FB33E0
-LISt=DefaultBuild\bl.map
-AUTO_SECTION_LAYOUT
-ROm=.data=.dataR
-ROm=.sdata=.sdataR
-NOMessage
-MEMory=High
-NOLOgo
-end
-Input=DefaultBuild\bl.abs
-DEVICE=E:\Program Files (x86)\renesas\CS+\CC\Device\RL78\Devicefile\DR5F10268.DVF
-OUtput=DefaultBuild\bl.mot
-FOrm=Stype
-NOMessage
-exit
--- SHA1 hash value of output files ---
F:\FCB_project\temp\blsz\bl_zc\DefaultBuild\bl.abs: 9d434a6fa5b144989d2767f0dd832e8e5ff71708
F:\FCB_project\temp\blsz\bl_zc\DefaultBuild\bl.mot: ed39827abcc7756b9a433bd535b80e626ff901b1
--- System Information ---
*OS Version
Microsoft Windows 10 专业版 (-, 10.0.19045, WOW64)
*Language
中文(中国)
*.NET Framework Version
Microsoft .NET Framework 4 [.NET 4.6 or later] (4.0.30319.42000)
--- Application Information ---
*Product Name
CS+ for CC
*Package Version
V8.07.00 [01 Dec 2021]
*Version
V9.07.00.06 [15 Nov 2021]
*Assembly Version
3.12.10.1
*Sales Area
Japan
*Product License
*Execution Place
E:\Program Files (x86)\renesas\CS+\CC
*Memory Usage
*Private Working Set
237 MB
*Number of GDI Objects
1756
*Number of USER Objects
837
*Opened Files
0 editors, 0 files, 0 KB
--- Build Tool Plug-in Information ---
RH850 Build tool CC-RH Plug-in
*Version
V8.02.00.00 [25 Mar 2019]
*Assembly Version
1.1.10.12
*DLL File Name
BuildToolCCRH.dll
RL78 Build tool CC-RL Plug-in
*Version
V8.05.00.00 [08 Oct 2020]
*Assembly Version
1.0.0.0
*DLL File Name
BuildToolCCRL.dll
RX Build tool CC-RX Plug-in
*Version
V8.02.00.00 [25 Mar 2019]
*Assembly Version
3.12.10.1
*DLL File Name
BuildToolCCRX.dll
RH850 Build tool GHS CCRH850 Plug-in
*Version
V1.05.00.00 [08 Oct 2020]
*Assembly Version
1.0.0.0
*DLL File Name
BuildToolGHSCCRH850.dll
--- Debug Tool Plug-in Information ---
Debugger Collection Plug-in
*Version
V8.07.00.05 [01 Dec 2021]
*Assembly Version
2.12.10.1
*DLL File Name
DebugToolCollection.dll
--- Other Plug-in Information ---
Code Generator Plug-in
*Version
V4.08.05.01 [14 Aug 2020]
*Assembly Version
3.0.0.0
*DLL File Name
CodePart.dll
Code Generator/PinView Plug-in
*Version
V2.10.07.02 [08 Nov 2021]
*Assembly Version
1.0.0.0
*DLL File Name
CodePart2.dll
Debug Console Plug-in
*Version
V7.00.00.01 [06 Apr 2018]
*Assembly Version
7.0.0.0
*DLL File Name
DebugConsole.dll
Quick and Effective tool solution - QE
*Version
V9.06.00.04 [25 May 2021]
*Assembly Version
1.15.10.16
*DLL File Name
InCarTools.dll
Pin Configurator Plug-in
*Version
V1.54.01.01 [31 Jul 2014]
*Assembly Version
1.6.10.23
*DLL File Name
PinConfig.dll
Program Analyzer Plug-in
*Version
V4.12.00.01 [14 Apr 2021]
*Assembly Version
3.12.11.9
*DLL File Name
ProgramAnalyzer.dll
IronPython Console Plug-in
*Version
V1.43.00.02 [29 Oct 2021]
*Assembly Version
1.6.10.23
*DLL File Name
PythonConsole.dll
Editor plug-in DLL
*Version
V1.17.00.01 [15 Oct 2020]
*Assembly Version
1.1.0.0
*DLL File Name
SEditor.dll
Stack Usage Tracer
*Version
V1.05.00.02 [30 Jul 2014]
*Assembly Version
1.30.11.15
*DLL File Name
Stk.dll
Update Manager Plug-in
*Version
V2.03.00.02 [29 Oct 2018]
*Assembly Version
1.13.6.20
*DLL File Name
Update.dll
Debug Tool Common Interface
*Version
V8.07.00.05 [01 Dec 2021]
*Assembly Version
3.12.10.1
*DLL File Name
CommonDebuggerInterface.dll
Device Information Common Interface
*Version
V9.07.00.01 [14 Oct 2021]
*Assembly Version
3.0.0.0
*DLL File Name
DeviceInformation.dll
--- Main Project Information ---
F:\FCB_project\temp\blsz\bl_zc\bl.mtpj
Microcontroller Information
*R5F10268
*File Name: Version
RL78_Productlist.xml: V8.070000
R5F10268_common.xml: V1.10.00.XX.01
DR5F10268.DVF: V1.12
g12_26xasp_flash.ti: V1.00
-: -
Build Tool Information
*CC-RL
* Version of plug-in(*.dll)
V8.07.00.03 [11 Nov 2021]
* The Version of the Compiler Package
V1.11.00
* The version of SMS Assembler
V1.00.00.01 [29 May 2020]
Debug Tool Information
*RL78 EZ Emulator
Debugger Library V8.07.00.05 [01 Dec 2021]
Other Tool Information
*None
*None
*Pin Configurator
*Program Analyzer
*Version
V4.12.00.01 [14 Apr 2021]
*Code Generator
Other Information
*RL78/G12 Code Library
*Version
V2.04.06.02 [08 Nov 2021]
*Description
Code library for RL78/G12 code generation plugin.

305
bl_zc/appTask.c Normal file
View File

@ -0,0 +1,305 @@
#include "r_cg_macrodriver.h"
#include "appTask.h"
#include "event.h"
#include "r_cg_port.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
#include "hwCtrl.h"
static uint8_t autoflag = 0;
static uint8_t updown = 0,stopflag = 0;
static uint8_t shortflag = 0;
#define UPDOWN_DOWN 1
#define UPDOWN_UP 2
#define UPDOWN_NO 0
void HardWare_Init(void)
{
//time base init
R_TAU0_Channel0_Start();
//output init
RLY1_Ctrl(OFF);
RLY2_Ctrl(OFF);
MOS_Ctrl(OFF);
//adc init
R_ADC_Start();
R_ADC_Set_OperationOn();
R_TAU0_Channel1_Start();//for adc scan
}
void Variable_Init(void)
{
autoflag = 0;
updown = 0;
shortflag = 0;
}
#define KEY_DELAY_TIME 6
#define KEY_DELAY_TIME_50ms 10
#define KEY_DELAY_TIME_8000ms 1600
void keyScan(void)//5ms
{
static uint16_t keydelay[4]={0,0,0,0};
static uint8_t keyflag[4]={0,0,0,0};
static uint8_t shoudong = 0;
if (GetKeyState(KEY_DOWN) == KEY_PRESSED)
{
keydelay[KEY_DOWN]++;
if (keydelay[KEY_DOWN] > KEY_DELAY_TIME)
{
keydelay[KEY_DOWN] = KEY_DELAY_TIME;
updown = UPDOWN_DOWN;
keyflag[KEY_DOWN] = 1;
if (autoflag == UPDOWN_DOWN)
{
shoudong = KEY_DOWN;
}
autoflag = UPDOWN_NO;
}
}
else
{
if (keydelay[KEY_AUTO]>=KEY_DELAY_TIME_50ms && keydelay[KEY_AUTO] < KEY_DELAY_TIME_8000ms && keyflag[KEY_DOWN] == 1 && shoudong != KEY_DOWN)
{
autoflag = UPDOWN_DOWN;
}
//updown = UPDOWN_NO;
keydelay[KEY_DOWN] = 0;
keyflag[KEY_DOWN] = 0;
if (shoudong == KEY_DOWN )
{
shoudong = 0;
}
}
if (GetKeyState(KEY_UP) == KEY_PRESSED)
{
keydelay[KEY_UP]++;
if (keydelay[KEY_UP] > KEY_DELAY_TIME)
{
keydelay[KEY_UP] = KEY_DELAY_TIME;
updown = UPDOWN_UP;
keyflag[KEY_UP] = 1;
if (autoflag == UPDOWN_DOWN)
{
shoudong = KEY_UP;
}
autoflag = UPDOWN_NO;
}
}
else
{
//updown = UPDOWN_NO;
keydelay[KEY_UP] = 0;
keyflag[KEY_UP] = 0;
if (shoudong == KEY_UP )
{
shoudong = 0;
}
}
if (shoudong != 0)
{
updown = UPDOWN_NO;
}
if (keyflag[KEY_UP]==0 && keyflag[KEY_DOWN]==0)
{
updown = UPDOWN_NO;
shortflag = 0;
stopflag = 0;
shoudong = 0;
}
if (GetKeyState(KEY_AUTO) == KEY_PRESSED)
{
keydelay[KEY_AUTO]++;
if (keydelay[KEY_AUTO] >= 2000)
{
keydelay[KEY_AUTO] = 2000;
}
}
else
{
if (keyflag[KEY_UP]==0 && keyflag[KEY_DOWN]==0)
{
keydelay[KEY_AUTO] = 0;
}
}
}
#define MOTOR_NONE 0
#define MOTOR_UP 1
#define MOTOR_DOWN 2
#define MOTOR_BREAK 3
void Motor_Ctrl(uint8_t state)
{
switch (state)
{
case MOTOR_UP:
RLY1_Ctrl(ON);
RLY2_Ctrl(OFF);
MOS_Ctrl(ON);
break;
case MOTOR_DOWN:
RLY1_Ctrl(OFF);
RLY2_Ctrl(ON);
MOS_Ctrl(ON);
break;
case MOTOR_BREAK:
RLY1_Ctrl(ON);
RLY2_Ctrl(ON);
MOS_Ctrl(ON);
break;
default:
RLY1_Ctrl(OFF);
RLY2_Ctrl(OFF);
MOS_Ctrl(OFF);
break;
}
}
#define OC_13A 30
#define OC_9A 21//30(13A)->21(9A)
#define OC_6A 12
extern uint16_t g_adcval;
void Output_Ctrl(void)
{
static uint16_t autotime=0;
static uint8_t oc_delay = 0;
if (g_adcval > OC_9A)
{
oc_delay++;
if (oc_delay > 20)
{
Motor_Ctrl(MOTOR_NONE);
shortflag = 1;
autoflag = UPDOWN_NO;
}
}
else
{
oc_delay = 0;
}
if (shortflag == 1)
{
Motor_Ctrl(MOTOR_NONE);
return;
}
if (stopflag == 1 )
{
Motor_Ctrl(MOTOR_NONE);
return;
}
if (updown == UPDOWN_DOWN)
{
Motor_Ctrl(MOTOR_UP);
//autotime = 0;
autotime++;
if (autotime > 800)//8s
{
Motor_Ctrl(MOTOR_NONE);
autotime = 0;
autoflag = 0;
stopflag = 1;
}
}
else if (updown == UPDOWN_UP)
{
Motor_Ctrl(MOTOR_DOWN);
//autotime = 0;
autotime++;
if (autotime > 800)//8s
{
Motor_Ctrl(MOTOR_NONE);
autotime = 0;
autoflag = 0;
stopflag = 1;
}
}
else if (updown == UPDOWN_NO)
{
if (autoflag == UPDOWN_DOWN)
{
Motor_Ctrl(MOTOR_UP);
autotime++;
if (autotime > 800)//8s
{
Motor_Ctrl(MOTOR_NONE);
autotime = 0;
autoflag = 0;
stopflag = 1;
}
}
else
{
Motor_Ctrl(MOTOR_NONE);
autotime = 0;
}
}
if (autotime > 800)//10ms * 800 = 8000 ms
{
autotime = 0;
autoflag = UPDOWN_NO;
}
}
void AppTask(void)
{
static uint8_t ledno = 1,last = 0;
if (TimeBase5msFlag == 1)
{
TimeBase5msFlag = 0;
keyScan();
}
if (TimeBase10msFlag == 1)
{
TimeBase10msFlag = 0;
Output_Ctrl();
//Motor_Ctrl(MOTOR_DOWN);
}
if (TimeBase100msFlag == 1)
{
TimeBase100msFlag = 0;
R_WDT_Restart();
}
if (TimeBase1000msFlag == 1)
{
TimeBase1000msFlag = 0;
/*
LED_Ctrl1LED(ledno,LED_ON);
LED_Ctrl1LED(last,LED_OFF);
last = ledno;
ledno++;
if (ledno > 9)
{
ledno = 1;
}
*/
}
}

9
bl_zc/appTask.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __APPTASK_H__
#define __APPTASK_H__
void HardWare_Init(void);
void Variable_Init(void);
void AppTask(void);
#endif

4564
bl_zc/bl.mtpj Normal file

File diff suppressed because it is too large Load Diff

1282
bl_zc/bl.rcpe Normal file

File diff suppressed because it is too large Load Diff

229
bl_zc/cstart.asm Normal file
View File

@ -0,0 +1,229 @@
;/**********************************************************************************************************************
; * DISCLAIMER
; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
; * applicable laws, including copyright laws.
; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO
; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
; * this software. By using this software, you agree to the additional terms and conditions found by accessing the
; * following link:
; * http://www.renesas.com/disclaimer
; *
; * Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
; *********************************************************************************************************************/
; NOTE : THIS IS A TYPICAL EXAMPLE.
$IFNDEF __RENESAS_VERSION__
__RENESAS_VERSION__ .EQU 0x01000000
$ENDIF
.public _start
.public _exit
;-----------------------------------------------------------------------------
; RAM section
;-----------------------------------------------------------------------------
.SECTION .dataR, DATA
.SECTION .sdataR, DATA
; .SECTION .datafR, DATAF
; .SECTION .textfR, TEXTF
$IF (__RENESAS_VERSION__ < 0x01010000) ; for CC-RL V1.00
;-----------------------------------------------------------------------------
; stack area
;-----------------------------------------------------------------------------
; !!! [CAUTION] !!!
; Set up stack size suitable for a project.
.SECTION .stack_bss, BSS
_stackend:
.DS 0x200
_stacktop:
$ENDIF
;-----------------------------------------------------------------------------
; RESET vector
;-----------------------------------------------------------------------------
_start .VECTOR 0
;-----------------------------------------------------------------------------
; startup
;-----------------------------------------------------------------------------
.SECTION .text, TEXT
_start:
;--------------------------------------------------
; setting register bank
;--------------------------------------------------
; SEL RB0
;--------------------------------------------------
; setting mirror area
;--------------------------------------------------
; ONEB !PMC ; mirror area = 10000-1FFFFH
;--------------------------------------------------
; setting the stack pointer
;--------------------------------------------------
$IF (__RENESAS_VERSION__ >= 0x01010000)
MOVW SP,#LOWW(__STACK_ADDR_START)
$ELSE ; for CC-RL V1.00
MOVW SP,#LOWW(_stacktop)
$ENDIF
;--------------------------------------------------
; initializing stack area
;--------------------------------------------------
$IF (__RENESAS_VERSION__ >= 0x01010000)
MOVW AX,#LOWW(__STACK_ADDR_END)
$ELSE ; for CC-RL V1.00
MOVW AX,#LOWW(_stackend)
$ENDIF
CALL !!_stkinit
;--------------------------------------------------
; hardware initialization
;--------------------------------------------------
CALL !!_hdwinit
;--------------------------------------------------
; initializing BSS
;--------------------------------------------------
; clear external variables which doesn't have initial value (near)
MOVW HL,#LOWW(STARTOF(.bss))
MOVW AX,#LOWW(STARTOF(.bss) + SIZEOF(.bss))
BR $.L2_BSS
.L1_BSS:
MOV [HL+0],#0
INCW HL
.L2_BSS:
CMPW AX,HL
BNZ $.L1_BSS
; clear saddr variables which doesn't have initial value
MOVW HL,#LOWW(STARTOF(.sbss))
MOVW AX,#LOWW(STARTOF(.sbss) + SIZEOF(.sbss))
BR $.L2_SBSS
.L1_SBSS:
MOV [HL+0],#0
INCW HL
.L2_SBSS:
CMPW AX,HL
BNZ $.L1_SBSS
; clear external variables which doesn't have initial value (far)
; MOV ES,#HIGHW(STARTOF(.bssf))
; MOVW HL,#LOWW(STARTOF(.bssf))
; MOVW AX,#LOWW(STARTOF(.bssf) + SIZEOF(.bssf))
; BR $.L2_BSSF
;.L1_BSSF:
; MOV ES:[HL+0],#0
; INCW HL
;.L2_BSSF:
; CMPW AX,HL
; BNZ $.L1_BSSF
;--------------------------------------------------
; ROM data copy
;--------------------------------------------------
; copy external variables having initial value (near)
MOV ES,#HIGHW(STARTOF(.data))
MOVW BC,#LOWW(SIZEOF(.data))
BR $.L2_DATA
.L1_DATA:
DECW BC
MOV A,ES:LOWW(STARTOF(.data))[BC]
MOV LOWW(STARTOF(.dataR))[BC],A
.L2_DATA:
CLRW AX
CMPW AX,BC
BNZ $.L1_DATA
; copy saddr variables having initial value
MOV ES,#HIGHW(STARTOF(.sdata))
MOVW BC,#LOWW(SIZEOF(.sdata))
BR $.L2_SDATA
.L1_SDATA:
DECW BC
MOV A,ES:LOWW(STARTOF(.sdata))[BC]
MOV LOWW(STARTOF(.sdataR))[BC],A
.L2_SDATA:
CLRW AX
CMPW AX,BC
BNZ $.L1_SDATA
; copy external variables having initial value (far)
; MOVW BC,#LOWW(SIZEOF(.dataf))
; BR $.L2_DATAF
;.L1_DATAF:
; DECW BC
; MOV ES,#HIGHW(STARTOF(.dataf))
; MOV A,ES:LOWW(STARTOF(.dataf))[BC]
; MOV ES,#HIGHW(STARTOF(.datafR))
; MOV ES:LOWW(STARTOF(.datafR))[BC],A
;.L2_DATAF:
; CLRW AX
; CMPW AX,BC
; BNZ $.L1_DATAF
; copy .text to RAM
; MOV C,#HIGHW(STARTOF(.textf))
; MOVW HL,#LOWW(STARTOF(.textf))
; MOVW DE,#LOWW(STARTOF(.textfR))
; BR $.L2_TEXT
;.L1_TEXT:
; MOV A,C
; MOV ES,A
; MOV A,ES:[HL]
; MOV [DE],A
; INCW DE
; INCW HL
; CLRW AX
; CMPW AX,HL
; SKNZ
; INC C
;.L2_TEXT:
; MOVW AX,HL
; CMPW AX,#LOWW(STARTOF(.text) + SIZEOF(.text))
; BNZ $.L1_TEXT
;--------------------------------------------------
; call main function
;--------------------------------------------------
CALL !!_main ; main();
;--------------------------------------------------
; call exit function
;--------------------------------------------------
CLRW AX ; exit(0)
_exit:
BR $_exit
;-----------------------------------------------------------------------------
; section
;-----------------------------------------------------------------------------
$IF (__RENESAS_VERSION__ >= 0x01010000)
.SECTION .RLIB, TEXTF
.L_section_RLIB:
.SECTION .SLIB, TEXTF
.L_section_SLIB:
$ENDIF
.SECTION .textf, TEXTF
.L_section_textf:
.SECTION .constf, CONSTF
.L_section_constf:
.SECTION .data, DATA
.L_section_data:
;.SECTION .dataf, DATAF
;.L_section_dataf:
.SECTION .sdata, SDATA
.L_section_sdata:
.SECTION .bss, BSS
.L_section_bss:
;.SECTION .bssf, BSSF
;.L_section_bssf:
.SECTION .sbss, SBSS
.L_section_sbss:

46
bl_zc/event.c Normal file
View File

@ -0,0 +1,46 @@
#include "event.h"
static volatile uint16_t TimeBaseCounter;
volatile uint8_t TimeBase1msFlag;
volatile uint8_t TimeBase5msFlag;
volatile uint8_t TimeBase10msFlag;
volatile uint8_t TimeBase20msFlag;
volatile uint8_t TimeBase50msFlag;
volatile uint8_t TimeBase100msFlag;
volatile uint8_t TimeBase1000msFlag;
void TimeBaseCount(void)
{
TimeBaseCounter++;
TimeBase1msFlag = 1;
if(TimeBaseCounter % 5 == 0)
{
TimeBase5msFlag = 1;
}
if(TimeBaseCounter % 10 == 0)
{
TimeBase10msFlag = 1;
}
if(TimeBaseCounter % 20 == 0)
{
TimeBase20msFlag = 1;
}
if(TimeBaseCounter % 50 == 0)
{
TimeBase50msFlag = 1;
}
if(TimeBaseCounter % 100 == 0)
{
TimeBase100msFlag = 1;
}
if(TimeBaseCounter % 1000 == 0)
{
TimeBase1000msFlag = 1;
}
if(TimeBaseCounter >= 60000)
{
TimeBaseCounter = 0;
}
}

18
bl_zc/event.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef __EVENT_H__
#define __EVENT_H__
#include "r_cg_macrodriver.h"
extern volatile uint8_t TimeBase1msFlag;
extern volatile uint8_t TimeBase5msFlag;
extern volatile uint8_t TimeBase10msFlag;
extern volatile uint8_t TimeBase20msFlag;
extern volatile uint8_t TimeBase50msFlag;
extern volatile uint8_t TimeBase100msFlag;
extern volatile uint8_t TimeBase1000msFlag;
extern void TimeBaseCount(void);
#endif

35
bl_zc/hdwinit.asm Normal file
View File

@ -0,0 +1,35 @@
;/**********************************************************************************************************************
; * DISCLAIMER
; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
; * applicable laws, including copyright laws.
; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO
; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
; * this software. By using this software, you agree to the additional terms and conditions found by accessing the
; * following link:
; * http://www.renesas.com/disclaimer
; *
; * Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
; *********************************************************************************************************************/;---------------------------------------------------------------------
; _hdwinit
;
; void _hdwinit(void);
;
; input:
; NONE
; output:
; NONE
;---------------------------------------------------------------------
; NOTE : THIS IS A TYPICAL EXAMPLE.
.PUBLIC _hdwinit
.textf .CSEG TEXTF
_hdwinit:
RET

73
bl_zc/hwCtrl.c Normal file
View File

@ -0,0 +1,73 @@
#include "hwCtrl.h"
#include "r_cg_port.h"
#include "iodefine.h"
#define IO_KEYUP P1_bit.no4
#define IO_KEYDOWN P1_bit.no0
#define IO_KEYAUTO P1_bit.no2
#define IO_OUT1 P2_bit.no0
#define IO_OUT2 P4_bit.no2
#define IO_MOS P2_bit.no1
void RLY1_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_OUT1 = 1;
}
else
{
IO_OUT1 = 0;
}
}
void RLY2_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_OUT2 = 1;
}
else
{
IO_OUT2 = 0;
}
}
void MOS_Ctrl(uint8_t onoff)
{
if (onoff == ON)
{
IO_MOS = 1;
}
else
{
IO_MOS = 0;
}
}
uint8_t GetKeyState(uint8_t keyno)
{
switch (keyno)
{
case KEY_DOWN:
return IO_KEYUP;
break;
case KEY_UP:
return IO_KEYDOWN;
break;
case KEY_AUTO:
return IO_KEYAUTO;
break;
default:
return 0;
break;
}
}

21
bl_zc/hwCtrl.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef __HWCTRL_H__
#define __HWCTRL_H__
#include "r_cg_macrodriver.h"
#define KEY_DOWN 1
#define KEY_UP 2
#define KEY_AUTO 3
#define ON 1
#define OFF 0
#define KEY_PRESSED 0
#define KEY_NOTPRESSES 1
uint8_t GetKeyState(uint8_t keyno);
void RLY1_Ctrl(uint8_t onoff);
void RLY2_Ctrl(uint8_t onoff);
void MOS_Ctrl(uint8_t onoff);
#endif

542
bl_zc/iodefine.h Normal file
View File

@ -0,0 +1,542 @@
/******************************************************************************/
/* DISCLAIMER */
/* This software is supplied by Renesas Electronics Corporation and is only */
/* intended for use with Renesas products. No other uses are authorized.This */
/* software is owned by Renesas Electronics Corporation and is protected */
/* under all applicable laws, including copyright laws. */
/* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES */
/* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING */
/* BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR */
/* PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY */
/* DISCLAIMED. */
/* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS */
/* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE */
/* LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL */
/* DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS */
/* AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. */
/* Renesas reserves the right, without notice, to make changes to this */
/* software and to discontinue the availability of this software. */
/* By using this software, you agree to the additional terms and conditions */
/* found by accessing the following link: */
/* http://www.renesas.com/disclaimer */
/* */
/* Device : RL78/R5F10268 */
/* File Name : iodefine.h */
/* Abstract : Definition of Special Function Register (SFR) */
/* History : V1.12 [Device File version] */
/* Options : -df=C:\Program Files (x86)\Renesas Electronics\CS+\CC\Device\ */
/* RL78\Devicefile\DR5F10268.DVF -o=F:\FCBproject\temp\bl\iodefi */
/* ne.h -f */
/* Date : 2022/4/28 */
/* Version : V1.15.00.01 [df2iodef.exe version] */
/* This is a typical example. */
/* */
/******************************************************************************/
#ifndef __R5F10268IODEFINE_HEADER__
#define __R5F10268IODEFINE_HEADER__
typedef struct
{
unsigned char no0:1;
unsigned char no1:1;
unsigned char no2:1;
unsigned char no3:1;
unsigned char no4:1;
unsigned char no5:1;
unsigned char no6:1;
unsigned char no7:1;
} __bitf_T;
typedef struct
{
unsigned char no0:1;
unsigned char no1:1;
unsigned char no2:1;
unsigned char no3:1;
unsigned char no4:1;
unsigned char no5:1;
unsigned char no6:1;
unsigned char no7:1;
unsigned char no8:1;
unsigned char no9:1;
unsigned char no10:1;
unsigned char no11:1;
unsigned char no12:1;
unsigned char no13:1;
unsigned char no14:1;
unsigned char no15:1;
} __bitf_T2;
#define ADM2 (*(volatile __near unsigned char *)0x10)
#define ADM2_bit (*(volatile __near __bitf_T *)0x10)
#define ADTYP (((volatile __near __bitf_T *)0x10)->no0)
#define AWC (((volatile __near __bitf_T *)0x10)->no2)
#define ADRCK (((volatile __near __bitf_T *)0x10)->no3)
#define ADUL (*(volatile __near unsigned char *)0x11)
#define ADLL (*(volatile __near unsigned char *)0x12)
#define ADTES (*(volatile __near unsigned char *)0x13)
#define PU1 (*(volatile __near unsigned char *)0x31)
#define PU1_bit (*(volatile __near __bitf_T *)0x31)
#define PU4 (*(volatile __near unsigned char *)0x34)
#define PU4_bit (*(volatile __near __bitf_T *)0x34)
#define PU12 (*(volatile __near unsigned char *)0x3C)
#define PU12_bit (*(volatile __near __bitf_T *)0x3C)
#define PIM1 (*(volatile __near unsigned char *)0x41)
#define PIM1_bit (*(volatile __near __bitf_T *)0x41)
#define POM1 (*(volatile __near unsigned char *)0x51)
#define POM1_bit (*(volatile __near __bitf_T *)0x51)
#define POM4 (*(volatile __near unsigned char *)0x54)
#define POM4_bit (*(volatile __near __bitf_T *)0x54)
#define PMC1 (*(volatile __near unsigned char *)0x61)
#define PMC1_bit (*(volatile __near __bitf_T *)0x61)
#define PMC4 (*(volatile __near unsigned char *)0x64)
#define PMC4_bit (*(volatile __near __bitf_T *)0x64)
#define NFEN0 (*(volatile __near unsigned char *)0x70)
#define NFEN0_bit (*(volatile __near __bitf_T *)0x70)
#define NFEN1 (*(volatile __near unsigned char *)0x71)
#define NFEN1_bit (*(volatile __near __bitf_T *)0x71)
#define ISC (*(volatile __near unsigned char *)0x73)
#define ISC_bit (*(volatile __near __bitf_T *)0x73)
#define TIS0 (*(volatile __near unsigned char *)0x74)
#define ADPC (*(volatile __near unsigned char *)0x76)
#define PIOR (*(volatile __near unsigned char *)0x77)
#define IAWCTL (*(volatile __near unsigned char *)0x78)
#define DFLCTL (*(volatile __near unsigned char *)0x90)
#define DFLCTL_bit (*(volatile __near __bitf_T *)0x90)
#define DFLEN (((volatile __near __bitf_T *)0x90)->no0)
#define HIOTRM (*(volatile __near unsigned char *)0xA0)
#define HOCODIV (*(volatile __near unsigned char *)0xA8)
#define TEMPCAL0 (*(volatile __near unsigned char *)0xAC)
#define TEMPCAL1 (*(volatile __near unsigned char *)0xAD)
#define TEMPCAL2 (*(volatile __near unsigned char *)0xAE)
#define TEMPCAL3 (*(volatile __near unsigned char *)0xAF)
#define MDCL (*(volatile __near unsigned short *)0xE0)
#define MDCH (*(volatile __near unsigned short *)0xE2)
#define MDUC (*(volatile __near unsigned char *)0xE8)
#define MDUC_bit (*(volatile __near __bitf_T *)0xE8)
#define DIVST (((volatile __near __bitf_T *)0xE8)->no0)
#define MACSF (((volatile __near __bitf_T *)0xE8)->no1)
#define MACOF (((volatile __near __bitf_T *)0xE8)->no2)
#define MDSM (((volatile __near __bitf_T *)0xE8)->no3)
#define MACMODE (((volatile __near __bitf_T *)0xE8)->no6)
#define DIVMODE (((volatile __near __bitf_T *)0xE8)->no7)
#define PER0 (*(volatile __near unsigned char *)0xF0)
#define PER0_bit (*(volatile __near __bitf_T *)0xF0)
#define TAU0EN (((volatile __near __bitf_T *)0xF0)->no0)
#define SAU0EN (((volatile __near __bitf_T *)0xF0)->no2)
#define IICA0EN (((volatile __near __bitf_T *)0xF0)->no4)
#define ADCEN (((volatile __near __bitf_T *)0xF0)->no5)
#define TMKAEN (((volatile __near __bitf_T *)0xF0)->no7)
#define OSMC (*(volatile __near unsigned char *)0xF3)
#define RMC (*(volatile __near unsigned char *)0xF4)
#define RMC_bit (*(volatile __near __bitf_T *)0xF4)
#define WDVOL (((volatile __near __bitf_T *)0xF4)->no7)
#define RPECTL (*(volatile __near unsigned char *)0xF5)
#define RPECTL_bit (*(volatile __near __bitf_T *)0xF5)
#define RPEF (((volatile __near __bitf_T *)0xF5)->no0)
#define RPERDIS (((volatile __near __bitf_T *)0xF5)->no7)
#define BCDADJ (*(volatile __near unsigned char *)0xFE)
#define SSR00 (*(volatile __near unsigned short *)0x100)
#define SSR00L (*(volatile __near unsigned char *)0x100)
#define SSR01 (*(volatile __near unsigned short *)0x102)
#define SSR01L (*(volatile __near unsigned char *)0x102)
#define SIR00 (*(volatile __near unsigned short *)0x108)
#define SIR00L (*(volatile __near unsigned char *)0x108)
#define SIR01 (*(volatile __near unsigned short *)0x10A)
#define SIR01L (*(volatile __near unsigned char *)0x10A)
#define SMR00 (*(volatile __near unsigned short *)0x110)
#define SMR01 (*(volatile __near unsigned short *)0x112)
#define SCR00 (*(volatile __near unsigned short *)0x118)
#define SCR01 (*(volatile __near unsigned short *)0x11A)
#define SE0 (*(volatile __near unsigned short *)0x120)
#define SE0L (*(volatile __near unsigned char *)0x120)
#define SE0L_bit (*(volatile __near __bitf_T *)0x120)
#define SS0 (*(volatile __near unsigned short *)0x122)
#define SS0L (*(volatile __near unsigned char *)0x122)
#define SS0L_bit (*(volatile __near __bitf_T *)0x122)
#define ST0 (*(volatile __near unsigned short *)0x124)
#define ST0L (*(volatile __near unsigned char *)0x124)
#define ST0L_bit (*(volatile __near __bitf_T *)0x124)
#define SPS0 (*(volatile __near unsigned short *)0x126)
#define SPS0L (*(volatile __near unsigned char *)0x126)
#define SO0 (*(volatile __near unsigned short *)0x128)
#define SOE0 (*(volatile __near unsigned short *)0x12A)
#define SOE0L (*(volatile __near unsigned char *)0x12A)
#define SOE0L_bit (*(volatile __near __bitf_T *)0x12A)
#define SOL0 (*(volatile __near unsigned short *)0x134)
#define SOL0L (*(volatile __near unsigned char *)0x134)
#define SSC0 (*(volatile __near unsigned short *)0x138)
#define SSC0L (*(volatile __near unsigned char *)0x138)
#define TCR00 (*(volatile __near unsigned short *)0x180)
#define TCR01 (*(volatile __near unsigned short *)0x182)
#define TCR02 (*(volatile __near unsigned short *)0x184)
#define TCR03 (*(volatile __near unsigned short *)0x186)
#define TMR00 (*(volatile __near unsigned short *)0x190)
#define TMR01 (*(volatile __near unsigned short *)0x192)
#define TMR02 (*(volatile __near unsigned short *)0x194)
#define TMR03 (*(volatile __near unsigned short *)0x196)
#define TSR00 (*(volatile __near unsigned short *)0x1A0)
#define TSR00L (*(volatile __near unsigned char *)0x1A0)
#define TSR01 (*(volatile __near unsigned short *)0x1A2)
#define TSR01L (*(volatile __near unsigned char *)0x1A2)
#define TSR02 (*(volatile __near unsigned short *)0x1A4)
#define TSR02L (*(volatile __near unsigned char *)0x1A4)
#define TSR03 (*(volatile __near unsigned short *)0x1A6)
#define TSR03L (*(volatile __near unsigned char *)0x1A6)
#define TE0 (*(volatile __near unsigned short *)0x1B0)
#define TE0L (*(volatile __near unsigned char *)0x1B0)
#define TE0L_bit (*(volatile __near __bitf_T *)0x1B0)
#define TS0 (*(volatile __near unsigned short *)0x1B2)
#define TS0L (*(volatile __near unsigned char *)0x1B2)
#define TS0L_bit (*(volatile __near __bitf_T *)0x1B2)
#define TT0 (*(volatile __near unsigned short *)0x1B4)
#define TT0L (*(volatile __near unsigned char *)0x1B4)
#define TT0L_bit (*(volatile __near __bitf_T *)0x1B4)
#define TPS0 (*(volatile __near unsigned short *)0x1B6)
#define TO0 (*(volatile __near unsigned short *)0x1B8)
#define TO0L (*(volatile __near unsigned char *)0x1B8)
#define TOE0 (*(volatile __near unsigned short *)0x1BA)
#define TOE0L (*(volatile __near unsigned char *)0x1BA)
#define TOE0L_bit (*(volatile __near __bitf_T *)0x1BA)
#define TOL0 (*(volatile __near unsigned short *)0x1BC)
#define TOL0L (*(volatile __near unsigned char *)0x1BC)
#define TOM0 (*(volatile __near unsigned short *)0x1BE)
#define TOM0L (*(volatile __near unsigned char *)0x1BE)
#define IICCTL00 (*(volatile __near unsigned char *)0x230)
#define IICCTL00_bit (*(volatile __near __bitf_T *)0x230)
#define SPT0 (((volatile __near __bitf_T *)0x230)->no0)
#define STT0 (((volatile __near __bitf_T *)0x230)->no1)
#define ACKE0 (((volatile __near __bitf_T *)0x230)->no2)
#define WTIM0 (((volatile __near __bitf_T *)0x230)->no3)
#define SPIE0 (((volatile __near __bitf_T *)0x230)->no4)
#define WREL0 (((volatile __near __bitf_T *)0x230)->no5)
#define LREL0 (((volatile __near __bitf_T *)0x230)->no6)
#define IICE0 (((volatile __near __bitf_T *)0x230)->no7)
#define IICCTL01 (*(volatile __near unsigned char *)0x231)
#define IICCTL01_bit (*(volatile __near __bitf_T *)0x231)
#define PRS0 (((volatile __near __bitf_T *)0x231)->no0)
#define DFC0 (((volatile __near __bitf_T *)0x231)->no2)
#define SMC0 (((volatile __near __bitf_T *)0x231)->no3)
#define DAD0 (((volatile __near __bitf_T *)0x231)->no4)
#define CLD0 (((volatile __near __bitf_T *)0x231)->no5)
#define WUP0 (((volatile __near __bitf_T *)0x231)->no7)
#define IICWL0 (*(volatile __near unsigned char *)0x232)
#define IICWH0 (*(volatile __near unsigned char *)0x233)
#define SVA0 (*(volatile __near unsigned char *)0x234)
#define CRCD (*(volatile __near unsigned short *)0x2FA)
#define P1 (*(volatile __near unsigned char *)0xFF01)
#define P1_bit (*(volatile __near __bitf_T *)0xFF01)
#define P2 (*(volatile __near unsigned char *)0xFF02)
#define P2_bit (*(volatile __near __bitf_T *)0xFF02)
#define P4 (*(volatile __near unsigned char *)0xFF04)
#define P4_bit (*(volatile __near __bitf_T *)0xFF04)
#define P6 (*(volatile __near unsigned char *)0xFF06)
#define P6_bit (*(volatile __near __bitf_T *)0xFF06)
#define P12 (*(volatile __near unsigned char *)0xFF0C)
#define P12_bit (*(volatile __near __bitf_T *)0xFF0C)
#define P13 (*(volatile __near unsigned char *)0xFF0D)
#define P13_bit (*(volatile __near __bitf_T *)0xFF0D)
#define SDR00 (*(volatile __near unsigned short *)0xFF10)
#define SIO00 (*(volatile __near unsigned char *)0xFF10)
#define TXD0 (*(volatile __near unsigned char *)0xFF10)
#define SDR01 (*(volatile __near unsigned short *)0xFF12)
#define RXD0 (*(volatile __near unsigned char *)0xFF12)
#define SIO01 (*(volatile __near unsigned char *)0xFF12)
#define TDR00 (*(volatile __near unsigned short *)0xFF18)
#define TDR01 (*(volatile __near unsigned short *)0xFF1A)
#define TDR01L (*(volatile __near unsigned char *)0xFF1A)
#define TDR01H (*(volatile __near unsigned char *)0xFF1B)
#define ADCR (*(volatile __near unsigned short *)0xFF1E)
#define ADCRH (*(volatile __near unsigned char *)0xFF1F)
#define PM1 (*(volatile __near unsigned char *)0xFF21)
#define PM1_bit (*(volatile __near __bitf_T *)0xFF21)
#define PM2 (*(volatile __near unsigned char *)0xFF22)
#define PM2_bit (*(volatile __near __bitf_T *)0xFF22)
#define PM4 (*(volatile __near unsigned char *)0xFF24)
#define PM4_bit (*(volatile __near __bitf_T *)0xFF24)
#define PM6 (*(volatile __near unsigned char *)0xFF26)
#define PM6_bit (*(volatile __near __bitf_T *)0xFF26)
#define ADM0 (*(volatile __near unsigned char *)0xFF30)
#define ADM0_bit (*(volatile __near __bitf_T *)0xFF30)
#define ADCE (((volatile __near __bitf_T *)0xFF30)->no0)
#define ADCS (((volatile __near __bitf_T *)0xFF30)->no7)
#define ADS (*(volatile __near unsigned char *)0xFF31)
#define ADS_bit (*(volatile __near __bitf_T *)0xFF31)
#define ADM1 (*(volatile __near unsigned char *)0xFF32)
#define ADM1_bit (*(volatile __near __bitf_T *)0xFF32)
#define KRCTL (*(volatile __near unsigned char *)0xFF34)
#define KRCTL_bit (*(volatile __near __bitf_T *)0xFF34)
#define KRF (*(volatile __near unsigned char *)0xFF35)
#define KRM0 (*(volatile __near unsigned char *)0xFF37)
#define KRM0_bit (*(volatile __near __bitf_T *)0xFF37)
#define EGP0 (*(volatile __near unsigned char *)0xFF38)
#define EGP0_bit (*(volatile __near __bitf_T *)0xFF38)
#define EGN0 (*(volatile __near unsigned char *)0xFF39)
#define EGN0_bit (*(volatile __near __bitf_T *)0xFF39)
#define IICA0 (*(volatile __near unsigned char *)0xFF50)
#define IICS0 (*(volatile __near unsigned char *)0xFF51)
#define IICS0_bit (*(volatile __near __bitf_T *)0xFF51)
#define SPD0 (((volatile __near __bitf_T *)0xFF51)->no0)
#define STD0 (((volatile __near __bitf_T *)0xFF51)->no1)
#define ACKD0 (((volatile __near __bitf_T *)0xFF51)->no2)
#define TRC0 (((volatile __near __bitf_T *)0xFF51)->no3)
#define COI0 (((volatile __near __bitf_T *)0xFF51)->no4)
#define EXC0 (((volatile __near __bitf_T *)0xFF51)->no5)
#define ALD0 (((volatile __near __bitf_T *)0xFF51)->no6)
#define MSTS0 (((volatile __near __bitf_T *)0xFF51)->no7)
#define IICF0 (*(volatile __near unsigned char *)0xFF52)
#define IICF0_bit (*(volatile __near __bitf_T *)0xFF52)
#define IICRSV0 (((volatile __near __bitf_T *)0xFF52)->no0)
#define STCEN0 (((volatile __near __bitf_T *)0xFF52)->no1)
#define IICBSY0 (((volatile __near __bitf_T *)0xFF52)->no6)
#define STCF0 (((volatile __near __bitf_T *)0xFF52)->no7)
#define TDR02 (*(volatile __near unsigned short *)0xFF64)
#define TDR03 (*(volatile __near unsigned short *)0xFF66)
#define TDR03L (*(volatile __near unsigned char *)0xFF66)
#define TDR03H (*(volatile __near unsigned char *)0xFF67)
#define ITMC (*(volatile __near unsigned short *)0xFF90)
#define CMC (*(volatile __near unsigned char *)0xFFA0)
#define CSC (*(volatile __near unsigned char *)0xFFA1)
#define CSC_bit (*(volatile __near __bitf_T *)0xFFA1)
#define HIOSTOP (((volatile __near __bitf_T *)0xFFA1)->no0)
#define MSTOP (((volatile __near __bitf_T *)0xFFA1)->no7)
#define OSTC (*(volatile __near unsigned char *)0xFFA2)
#define OSTC_bit (*(volatile __near __bitf_T *)0xFFA2)
#define OSTS (*(volatile __near unsigned char *)0xFFA3)
#define CKC (*(volatile __near unsigned char *)0xFFA4)
#define CKC_bit (*(volatile __near __bitf_T *)0xFFA4)
#define MCM0 (((volatile __near __bitf_T *)0xFFA4)->no4)
#define MCS (((volatile __near __bitf_T *)0xFFA4)->no5)
#define CKS0 (*(volatile __near unsigned char *)0xFFA5)
#define CKS0_bit (*(volatile __near __bitf_T *)0xFFA5)
#define PCLOE0 (((volatile __near __bitf_T *)0xFFA5)->no7)
#define RESF (*(volatile __near unsigned char *)0xFFA8)
#define LVIM (*(volatile __near unsigned char *)0xFFA9)
#define LVIM_bit (*(volatile __near __bitf_T *)0xFFA9)
#define LVIF (((volatile __near __bitf_T *)0xFFA9)->no0)
#define LVIOMSK (((volatile __near __bitf_T *)0xFFA9)->no1)
#define LVISEN (((volatile __near __bitf_T *)0xFFA9)->no7)
#define LVIS (*(volatile __near unsigned char *)0xFFAA)
#define LVIS_bit (*(volatile __near __bitf_T *)0xFFAA)
#define LVILV (((volatile __near __bitf_T *)0xFFAA)->no0)
#define LVIMD (((volatile __near __bitf_T *)0xFFAA)->no7)
#define WDTE (*(volatile __near unsigned char *)0xFFAB)
#define CRCIN (*(volatile __near unsigned char *)0xFFAC)
#define DSA0 (*(volatile __near unsigned char *)0xFFB0)
#define DSA1 (*(volatile __near unsigned char *)0xFFB1)
#define DRA0 (*(volatile __near unsigned short *)0xFFB2)
#define DRA0L (*(volatile __near unsigned char *)0xFFB2)
#define DRA0H (*(volatile __near unsigned char *)0xFFB3)
#define DRA1 (*(volatile __near unsigned short *)0xFFB4)
#define DRA1L (*(volatile __near unsigned char *)0xFFB4)
#define DRA1H (*(volatile __near unsigned char *)0xFFB5)
#define DBC0 (*(volatile __near unsigned short *)0xFFB6)
#define DBC0L (*(volatile __near unsigned char *)0xFFB6)
#define DBC0H (*(volatile __near unsigned char *)0xFFB7)
#define DBC1 (*(volatile __near unsigned short *)0xFFB8)
#define DBC1L (*(volatile __near unsigned char *)0xFFB8)
#define DBC1H (*(volatile __near unsigned char *)0xFFB9)
#define DMC0 (*(volatile __near unsigned char *)0xFFBA)
#define DMC0_bit (*(volatile __near __bitf_T *)0xFFBA)
#define DWAIT0 (((volatile __near __bitf_T *)0xFFBA)->no4)
#define DS0 (((volatile __near __bitf_T *)0xFFBA)->no5)
#define DRS0 (((volatile __near __bitf_T *)0xFFBA)->no6)
#define STG0 (((volatile __near __bitf_T *)0xFFBA)->no7)
#define DMC1 (*(volatile __near unsigned char *)0xFFBB)
#define DMC1_bit (*(volatile __near __bitf_T *)0xFFBB)
#define DWAIT1 (((volatile __near __bitf_T *)0xFFBB)->no4)
#define DS1 (((volatile __near __bitf_T *)0xFFBB)->no5)
#define DRS1 (((volatile __near __bitf_T *)0xFFBB)->no6)
#define STG1 (((volatile __near __bitf_T *)0xFFBB)->no7)
#define DRC0 (*(volatile __near unsigned char *)0xFFBC)
#define DRC0_bit (*(volatile __near __bitf_T *)0xFFBC)
#define DST0 (((volatile __near __bitf_T *)0xFFBC)->no0)
#define DEN0 (((volatile __near __bitf_T *)0xFFBC)->no7)
#define DRC1 (*(volatile __near unsigned char *)0xFFBD)
#define DRC1_bit (*(volatile __near __bitf_T *)0xFFBD)
#define DST1 (((volatile __near __bitf_T *)0xFFBD)->no0)
#define DEN1 (((volatile __near __bitf_T *)0xFFBD)->no7)
#define IF0 (*(volatile __near unsigned short *)0xFFE0)
#define IF0L (*(volatile __near unsigned char *)0xFFE0)
#define IF0L_bit (*(volatile __near __bitf_T *)0xFFE0)
#define IF0H (*(volatile __near unsigned char *)0xFFE1)
#define IF0H_bit (*(volatile __near __bitf_T *)0xFFE1)
#define WDTIIF (((volatile __near __bitf_T *)0xFFE0)->no0)
#define LVIIF (((volatile __near __bitf_T *)0xFFE0)->no1)
#define PIF0 (((volatile __near __bitf_T *)0xFFE0)->no2)
#define PIF1 (((volatile __near __bitf_T *)0xFFE0)->no3)
#define PIF2 (((volatile __near __bitf_T *)0xFFE0)->no4)
#define PIF3 (((volatile __near __bitf_T *)0xFFE0)->no5)
#define DMAIF0 (((volatile __near __bitf_T *)0xFFE0)->no6)
#define DMAIF1 (((volatile __near __bitf_T *)0xFFE0)->no7)
#define CSIIF00 (((volatile __near __bitf_T *)0xFFE1)->no0)
#define IICIF00 (((volatile __near __bitf_T *)0xFFE1)->no0)
#define STIF0 (((volatile __near __bitf_T *)0xFFE1)->no0)
#define CSIIF01 (((volatile __near __bitf_T *)0xFFE1)->no1)
#define IICIF01 (((volatile __near __bitf_T *)0xFFE1)->no1)
#define SRIF0 (((volatile __near __bitf_T *)0xFFE1)->no1)
#define SREIF0 (((volatile __near __bitf_T *)0xFFE1)->no2)
#define TMIF01H (((volatile __near __bitf_T *)0xFFE1)->no3)
#define TMIF03H (((volatile __near __bitf_T *)0xFFE1)->no4)
#define IICAIF0 (((volatile __near __bitf_T *)0xFFE1)->no5)
#define TMIF00 (((volatile __near __bitf_T *)0xFFE1)->no6)
#define TMIF01 (((volatile __near __bitf_T *)0xFFE1)->no7)
#define IF1 (*(volatile __near unsigned short *)0xFFE2)
#define IF1L (*(volatile __near unsigned char *)0xFFE2)
#define IF1L_bit (*(volatile __near __bitf_T *)0xFFE2)
#define TMIF02 (((volatile __near __bitf_T *)0xFFE2)->no0)
#define TMIF03 (((volatile __near __bitf_T *)0xFFE2)->no1)
#define ADIF (((volatile __near __bitf_T *)0xFFE2)->no2)
#define TMKAIF (((volatile __near __bitf_T *)0xFFE2)->no3)
#define KRIF (((volatile __near __bitf_T *)0xFFE2)->no4)
#define MDIF (((volatile __near __bitf_T *)0xFFE2)->no5)
#define FLIF (((volatile __near __bitf_T *)0xFFE2)->no6)
#define MK0 (*(volatile __near unsigned short *)0xFFE4)
#define MK0L (*(volatile __near unsigned char *)0xFFE4)
#define MK0L_bit (*(volatile __near __bitf_T *)0xFFE4)
#define MK0H (*(volatile __near unsigned char *)0xFFE5)
#define MK0H_bit (*(volatile __near __bitf_T *)0xFFE5)
#define WDTIMK (((volatile __near __bitf_T *)0xFFE4)->no0)
#define LVIMK (((volatile __near __bitf_T *)0xFFE4)->no1)
#define PMK0 (((volatile __near __bitf_T *)0xFFE4)->no2)
#define PMK1 (((volatile __near __bitf_T *)0xFFE4)->no3)
#define PMK2 (((volatile __near __bitf_T *)0xFFE4)->no4)
#define PMK3 (((volatile __near __bitf_T *)0xFFE4)->no5)
#define DMAMK0 (((volatile __near __bitf_T *)0xFFE4)->no6)
#define DMAMK1 (((volatile __near __bitf_T *)0xFFE4)->no7)
#define CSIMK00 (((volatile __near __bitf_T *)0xFFE5)->no0)
#define IICMK00 (((volatile __near __bitf_T *)0xFFE5)->no0)
#define STMK0 (((volatile __near __bitf_T *)0xFFE5)->no0)
#define CSIMK01 (((volatile __near __bitf_T *)0xFFE5)->no1)
#define IICMK01 (((volatile __near __bitf_T *)0xFFE5)->no1)
#define SRMK0 (((volatile __near __bitf_T *)0xFFE5)->no1)
#define SREMK0 (((volatile __near __bitf_T *)0xFFE5)->no2)
#define TMMK01H (((volatile __near __bitf_T *)0xFFE5)->no3)
#define TMMK03H (((volatile __near __bitf_T *)0xFFE5)->no4)
#define IICAMK0 (((volatile __near __bitf_T *)0xFFE5)->no5)
#define TMMK00 (((volatile __near __bitf_T *)0xFFE5)->no6)
#define TMMK01 (((volatile __near __bitf_T *)0xFFE5)->no7)
#define MK1 (*(volatile __near unsigned short *)0xFFE6)
#define MK1L (*(volatile __near unsigned char *)0xFFE6)
#define MK1L_bit (*(volatile __near __bitf_T *)0xFFE6)
#define TMMK02 (((volatile __near __bitf_T *)0xFFE6)->no0)
#define TMMK03 (((volatile __near __bitf_T *)0xFFE6)->no1)
#define ADMK (((volatile __near __bitf_T *)0xFFE6)->no2)
#define TMKAMK (((volatile __near __bitf_T *)0xFFE6)->no3)
#define KRMK (((volatile __near __bitf_T *)0xFFE6)->no4)
#define MDMK (((volatile __near __bitf_T *)0xFFE6)->no5)
#define FLMK (((volatile __near __bitf_T *)0xFFE6)->no6)
#define PR00 (*(volatile __near unsigned short *)0xFFE8)
#define PR00L (*(volatile __near unsigned char *)0xFFE8)
#define PR00L_bit (*(volatile __near __bitf_T *)0xFFE8)
#define PR00H (*(volatile __near unsigned char *)0xFFE9)
#define PR00H_bit (*(volatile __near __bitf_T *)0xFFE9)
#define WDTIPR0 (((volatile __near __bitf_T *)0xFFE8)->no0)
#define LVIPR0 (((volatile __near __bitf_T *)0xFFE8)->no1)
#define PPR00 (((volatile __near __bitf_T *)0xFFE8)->no2)
#define PPR01 (((volatile __near __bitf_T *)0xFFE8)->no3)
#define PPR02 (((volatile __near __bitf_T *)0xFFE8)->no4)
#define PPR03 (((volatile __near __bitf_T *)0xFFE8)->no5)
#define DMAPR00 (((volatile __near __bitf_T *)0xFFE8)->no6)
#define DMAPR01 (((volatile __near __bitf_T *)0xFFE8)->no7)
#define CSIPR000 (((volatile __near __bitf_T *)0xFFE9)->no0)
#define IICPR000 (((volatile __near __bitf_T *)0xFFE9)->no0)
#define STPR00 (((volatile __near __bitf_T *)0xFFE9)->no0)
#define CSIPR001 (((volatile __near __bitf_T *)0xFFE9)->no1)
#define IICPR001 (((volatile __near __bitf_T *)0xFFE9)->no1)
#define SRPR00 (((volatile __near __bitf_T *)0xFFE9)->no1)
#define SREPR00 (((volatile __near __bitf_T *)0xFFE9)->no2)
#define TMPR001H (((volatile __near __bitf_T *)0xFFE9)->no3)
#define TMPR003H (((volatile __near __bitf_T *)0xFFE9)->no4)
#define IICAPR00 (((volatile __near __bitf_T *)0xFFE9)->no5)
#define TMPR000 (((volatile __near __bitf_T *)0xFFE9)->no6)
#define TMPR001 (((volatile __near __bitf_T *)0xFFE9)->no7)
#define PR01 (*(volatile __near unsigned short *)0xFFEA)
#define PR01L (*(volatile __near unsigned char *)0xFFEA)
#define PR01L_bit (*(volatile __near __bitf_T *)0xFFEA)
#define TMPR002 (((volatile __near __bitf_T *)0xFFEA)->no0)
#define TMPR003 (((volatile __near __bitf_T *)0xFFEA)->no1)
#define ADPR0 (((volatile __near __bitf_T *)0xFFEA)->no2)
#define TMKAPR0 (((volatile __near __bitf_T *)0xFFEA)->no3)
#define KRPR0 (((volatile __near __bitf_T *)0xFFEA)->no4)
#define MDPR0 (((volatile __near __bitf_T *)0xFFEA)->no5)
#define FLPR0 (((volatile __near __bitf_T *)0xFFEA)->no6)
#define PR10 (*(volatile __near unsigned short *)0xFFEC)
#define PR10L (*(volatile __near unsigned char *)0xFFEC)
#define PR10L_bit (*(volatile __near __bitf_T *)0xFFEC)
#define PR10H (*(volatile __near unsigned char *)0xFFED)
#define PR10H_bit (*(volatile __near __bitf_T *)0xFFED)
#define WDTIPR1 (((volatile __near __bitf_T *)0xFFEC)->no0)
#define LVIPR1 (((volatile __near __bitf_T *)0xFFEC)->no1)
#define PPR10 (((volatile __near __bitf_T *)0xFFEC)->no2)
#define PPR11 (((volatile __near __bitf_T *)0xFFEC)->no3)
#define PPR12 (((volatile __near __bitf_T *)0xFFEC)->no4)
#define PPR13 (((volatile __near __bitf_T *)0xFFEC)->no5)
#define DMAPR10 (((volatile __near __bitf_T *)0xFFEC)->no6)
#define DMAPR11 (((volatile __near __bitf_T *)0xFFEC)->no7)
#define CSIPR100 (((volatile __near __bitf_T *)0xFFED)->no0)
#define IICPR100 (((volatile __near __bitf_T *)0xFFED)->no0)
#define STPR10 (((volatile __near __bitf_T *)0xFFED)->no0)
#define CSIPR101 (((volatile __near __bitf_T *)0xFFED)->no1)
#define IICPR101 (((volatile __near __bitf_T *)0xFFED)->no1)
#define SRPR10 (((volatile __near __bitf_T *)0xFFED)->no1)
#define SREPR10 (((volatile __near __bitf_T *)0xFFED)->no2)
#define TMPR101H (((volatile __near __bitf_T *)0xFFED)->no3)
#define TMPR103H (((volatile __near __bitf_T *)0xFFED)->no4)
#define IICAPR10 (((volatile __near __bitf_T *)0xFFED)->no5)
#define TMPR100 (((volatile __near __bitf_T *)0xFFED)->no6)
#define TMPR101 (((volatile __near __bitf_T *)0xFFED)->no7)
#define PR11 (*(volatile __near unsigned short *)0xFFEE)
#define PR11L (*(volatile __near unsigned char *)0xFFEE)
#define PR11L_bit (*(volatile __near __bitf_T *)0xFFEE)
#define TMPR102 (((volatile __near __bitf_T *)0xFFEE)->no0)
#define TMPR103 (((volatile __near __bitf_T *)0xFFEE)->no1)
#define ADPR1 (((volatile __near __bitf_T *)0xFFEE)->no2)
#define TMKAPR1 (((volatile __near __bitf_T *)0xFFEE)->no3)
#define KRPR1 (((volatile __near __bitf_T *)0xFFEE)->no4)
#define MDPR1 (((volatile __near __bitf_T *)0xFFEE)->no5)
#define FLPR1 (((volatile __near __bitf_T *)0xFFEE)->no6)
#define MDAL (*(volatile __near unsigned short *)0xFFF0)
#define MULA (*(volatile __near unsigned short *)0xFFF0)
#define MDAH (*(volatile __near unsigned short *)0xFFF2)
#define MULB (*(volatile __near unsigned short *)0xFFF2)
#define MDBH (*(volatile __near unsigned short *)0xFFF4)
#define MULOH (*(volatile __near unsigned short *)0xFFF4)
#define MDBL (*(volatile __near unsigned short *)0xFFF6)
#define MULOL (*(volatile __near unsigned short *)0xFFF6)
#define PMC (*(volatile __near unsigned char *)0xFFFE)
#define PMC_bit (*(volatile __near __bitf_T *)0xFFFE)
#define MAA (((volatile __near __bitf_T *)0xFFFE)->no0)
#define INTWDTI 0x0004
#define INTLVI 0x0006
#define INTP0 0x0008
#define INTP1 0x000A
#define INTP2 0x000C
#define INTP3 0x000E
#define INTDMA0 0x0010
#define INTDMA1 0x0012
#define INTCSI00 0x0014
#define INTIIC00 0x0014
#define INTST0 0x0014
#define INTCSI01 0x0016
#define INTIIC01 0x0016
#define INTSR0 0x0016
#define INTSRE0 0x0018
#define INTTM01H 0x001A
#define INTTM03H 0x001C
#define INTIICA0 0x001E
#define INTTM00 0x0020
#define INTTM01 0x0022
#define INTTM02 0x0024
#define INTTM03 0x0026
#define INTAD 0x0028
#define INTIT 0x002A
#define INTKR 0x002C
#define INTMD 0x002E
#define INTFL 0x0030
#endif

8
bl_zc/myDef.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef __MYDEF_H__
#define __MYDEF_H__
#endif

139
bl_zc/r_cg_adc.c Normal file
View File

@ -0,0 +1,139 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_adc.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for ADC module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_adc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_ADC_Create
* Description : This function initializes the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Create(void)
{
ADCEN = 1U; /* supply AD clock */
ADM0 = _00_AD_ADM0_INITIALVALUE; /* disable AD conversion and clear ADM0 register */
ADMK = 1U; /* disable INTAD interrupt */
ADIF = 0U; /* clear INTAD interrupt flag */
/* Set INTAD low priority */
ADPR1 = 1U;
ADPR0 = 1U;
/* The reset status of ADPC is analog input, so it's unnecessary to set. */
/* Set ANI19 pin */
PMC1 |= 0x08U;
PM1 |= 0x08U;
ADM0 = _08_AD_CONVERSION_CLOCK_32 | _04_AD_TIME_MODE_LOWVOLTAGE_1 | _00_AD_OPERMODE_SELECT;
ADM1 = _80_AD_TRIGGER_HARDWARE_NOWAIT | _20_AD_CONVMODE_ONESELECT | _00_AD_TRIGGER_INTTM01;
ADM2 = _00_AD_POSITIVE_VDD | _00_AD_NEGATIVE_VSS | _00_AD_AREA_MODE_1 | _00_AD_RESOLUTION_10BIT;
ADUL = _FF_AD_ADUL_VALUE;
ADLL = _00_AD_ADLL_VALUE;
ADS = _13_AD_INPUT_CHANNEL_19;
ADCE = 1U; /* enable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Start
* Description : This function starts the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Start(void)
{
ADIF = 0U; /* clear INTAD interrupt flag */
ADMK = 0U; /* enable INTAD interrupt */
ADCS = 1U; /* enable AD conversion */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Stop
* Description : This function stops the AD converter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Stop(void)
{
ADCS = 0U; /* disable AD conversion */
ADMK = 1U; /* disable INTAD interrupt */
ADIF = 0U; /* clear INTAD interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Set_OperationOn
* Description : This function enables comparator operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Set_OperationOn(void)
{
ADCE = 1U; /* enable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Set_OperationOff
* Description : This function stops comparator operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Set_OperationOff(void)
{
ADCE = 0U; /* disable AD comparator */
}
/***********************************************************************************************************************
* Function Name: R_ADC_Get_Result
* Description : This function returns the conversion result in the buffer.
* Arguments : buffer -
* the address where to write the conversion result
* Return Value : None
***********************************************************************************************************************/
void R_ADC_Get_Result(uint16_t * const buffer)
{
*buffer = (uint16_t)(ADCR >> 6U);
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

179
bl_zc/r_cg_adc.h Normal file
View File

@ -0,0 +1,179 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_adc.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for ADC module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef ADC_H
#define ADC_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Peripheral enable register 0 (PER0)
*/
/* Control of AD converter input clock (ADCEN) */
#define _00_AD_CLOCK_STOP (0x00U) /* stop supply of input clock */
#define _20_AD_CLOCK_SUPPLY (0x20U) /* supply input clock */
/*
AD converter mode register 0 (ADM0)
*/
#define _00_AD_ADM0_INITIALVALUE (0x00U)
/* AD conversion operation control (ADCS) */
#define _80_AD_CONVERSION_ENABLE (0x80U) /* enable AD conversion operation control */
#define _00_AD_CONVERSION_DISABLE (0x00U) /* disable AD conversion operation control */
/* Specification of AD conversion operation mode (ADMD) */
#define _00_AD_OPERMODE_SELECT (0x00U) /* select operation mode */
#define _40_AD_OPERMODE_SCAN (0x40U) /* scan operation mode */
/* AD conversion clock selection (FR2 - FR0) */
#define _00_AD_CONVERSION_CLOCK_64 (0x00U) /* fCLK/64 */
#define _08_AD_CONVERSION_CLOCK_32 (0x08U) /* fCLK/32 */
#define _10_AD_CONVERSION_CLOCK_16 (0x10U) /* fCLK/16 */
#define _18_AD_CONVERSION_CLOCK_8 (0x18U) /* fCLK/8 */
#define _20_AD_CONVERSION_CLOCK_6 (0x20U) /* fCLK/6 */
#define _28_AD_CONVERSION_CLOCK_5 (0x28U) /* fCLK/5 */
#define _30_AD_CONVERSION_CLOCK_4 (0x30U) /* fCLK/4 */
#define _38_AD_CONVERSION_CLOCK_2 (0x38U) /* fCLK/2 */
/* Specification AD conversion time mode (LV1, LV0) */
#define _00_AD_TIME_MODE_NORMAL_1 (0x00U) /* normal 1 mode */
#define _02_AD_TIME_MODE_NORMAL_2 (0x02U) /* normal 2 mode */
#define _04_AD_TIME_MODE_LOWVOLTAGE_1 (0x04U) /* low-voltage 1 mode */
#define _06_AD_TIME_MODE_LOWVOLTAGE_2 (0x06U) /* low-voltage 2 mode */
/* AD comparator operation control (ADCE) */
#define _01_AD_COMPARATOR_ENABLE (0x01U) /* enable comparator operation control */
#define _00_AD_COMPARATOR_DISABLE (0x00U) /* disable comparator operation control */
/*
Analog input channel specification register (ADS)
*/
/* Specification of analog input channel (ADISS, ADS4 - ADS0) */
/* Select mode */
#define _00_AD_INPUT_CHANNEL_0 (0x00U) /* ANI0 */
#define _01_AD_INPUT_CHANNEL_1 (0x01U) /* ANI1 */
#define _02_AD_INPUT_CHANNEL_2 (0x02U) /* ANI2 */
#define _03_AD_INPUT_CHANNEL_3 (0x03U) /* ANI3 */
#define _10_AD_INPUT_CHANNEL_16 (0x10U) /* ANI16 */
#define _11_AD_INPUT_CHANNEL_17 (0x11U) /* ANI17 */
#define _12_AD_INPUT_CHANNEL_18 (0x12U) /* ANI18 */
#define _13_AD_INPUT_CHANNEL_19 (0x13U) /* ANI19 */
#define _14_AD_INPUT_CHANNEL_20 (0x14U) /* ANI20 */
#define _15_AD_INPUT_CHANNEL_21 (0x15U) /* ANI21 */
#define _16_AD_INPUT_CHANNEL_22 (0x16U) /* ANI22 */
#define _80_AD_INPUT_TEMPERSENSOR_0 (0x80U) /* temperature sensor 0 output is used to be the input channel */
#define _81_AD_INPUT_INTERREFVOLT (0x81U) /* internal reference voltage output is used to be the input channel */
/* Scan mode */
#define _00_AD_INPUT_CHANNEL_0_3 (0x00U) /* ANI0 - ANI3 */
/*
AD converter mode register 1 (ADM1)
*/
/* AD trigger mode selection (ADTMD1, ADTMD0) */
#define _00_AD_TRIGGER_SOFTWARE (0x00U) /* software trigger mode */
#define _80_AD_TRIGGER_HARDWARE_NOWAIT (0x80U) /* hardware trigger mode (no wait) */
#define _C0_AD_TRIGGER_HARDWARE_WAIT (0xC0U) /* hardware trigger mode (wait) */
/* AD convertion mode selection (ADSCM) */
#define _00_AD_CONVMODE_CONSELECT (0x00U) /* continuous convertion mode */
#define _20_AD_CONVMODE_ONESELECT (0x20U) /* oneshot convertion mode */
/* Trigger signal selection (ADTRS1, ADTRS0) */
#define _00_AD_TRIGGER_INTTM01 (0x00U) /* INTTM01 */
#define _03_AD_TRIGGER_INTIT (0x03U) /* INTIT */
/*
AD converter mode register 2 (ADM2)
*/
/* AD VREF(+) selection (ADREFP1, ADREFP0) */
#define _00_AD_POSITIVE_VDD (0x00U) /* use VDD as VREF(+) */
#define _40_AD_POSITIVE_AVREFP (0x40U) /* use AVREFP as VREF(+) */
#define _80_AD_POSITIVE_INTERVOLT (0x80U) /* use internal voltage as VREF(+) */
/* AD VREF(-) selection (ADREFM) */
#define _00_AD_NEGATIVE_VSS (0x00U) /* use VSS as VREF(-) */
#define _20_AD_NEGATIVE_AVREFM (0x20U) /* use AVREFM as VREF(-) */
/* AD conversion result upper/lower bound value selection (ADRCK) */
#define _00_AD_AREA_MODE_1 (0x00U) /* generates INTAD when ADLL <= ADCRH <= ADUL */
#define _08_AD_AREA_MODE_2_3 (0x08U) /* generates INTAD when ADUL < ADCRH or ADLL > ADCRH */
/* AD wakeup function selection (AWC) */
#define _00_AD_WAKEUP_OFF (0x00U) /* stop wakeup function */
#define _04_AD_WAKEUP_ON (0x04U) /* use wakeup function */
/* AD resolution selection (ADTYP) */
#define _00_AD_RESOLUTION_10BIT (0x00U) /* 10 bits */
#define _01_AD_RESOLUTION_8BIT (0x01U) /* 8 bits */
/*
AD test function register (ADTES)
*/
/* AD test mode signal (ADTES1, ADTES0) */
#define _00_AD_NORMAL_INPUT (0x00U) /* normal mode */
#define _02_AD_TEST_AVREFM (0x02U) /* use AVREFM as test signal */
#define _03_AD_TEST_AVREFP (0x03U) /* use AVREFP as test signal */
/*
AD port configuration register (ADPC)
*/
/* Analog input/digital input switching (ADPC3 - ADPC0) */
#define _00_AD_ADPC_4ANALOG (0x00U) /* ANI0 - ANI3 */
#define _04_AD_ADPC_3ANALOG (0x04U) /* ANI0 - ANI2 */
#define _03_AD_ADPC_2ANALOG (0x03U) /* ANI0 - ANI1 */
#define _02_AD_ADPC_1ANALOG (0x02U) /* ANI0 */
#define _01_AD_ADPC_0ANALOG (0x01U) /* ANI0 - ANI4 (all digital) */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/* Upper bound (ADUL) value */
#define _FF_AD_ADUL_VALUE (0xFFU)
/* Upper bound (ADLL) value */
#define _00_AD_ADLL_VALUE (0x00U)
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef enum
{
ADCHANNEL0, ADCHANNEL1, ADCHANNEL2, ADCHANNEL3, ADCHANNEL16 = 16U,
ADCHANNEL17, ADCHANNEL18, ADCHANNEL19, ADCHANNEL20, ADCHANNEL21,
ADCHANNEL22, ADTEMPERSENSOR0 = 128U, ADINTERREFVOLT
} ad_channel_t;
typedef enum
{
ADNORMALINPUT,
ADAVREFM = 2U,
ADAVREFP
} test_channel_t;
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_ADC_Create(void);
void R_ADC_Start(void);
void R_ADC_Stop(void);
void R_ADC_Set_OperationOn(void);
void R_ADC_Set_OperationOff(void);
void R_ADC_Get_Result(uint16_t * const buffer);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

66
bl_zc/r_cg_adc_user.c Normal file
View File

@ -0,0 +1,66 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_adc_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for ADC module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_adc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_adc_interrupt(vect=INTAD)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
uint16_t g_adcval=0;
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_adc_interrupt
* Description : This function is INTAD interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_adc_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
R_ADC_Get_Result(&g_adcval);
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

69
bl_zc/r_cg_cgc.c Normal file
View File

@ -0,0 +1,69 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_cgc.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_CGC_Create
* Description : This function initializes the clock generator.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CGC_Create(void)
{
/* Set fMX */
CMC = _00_CGC_HISYS_PORT | _00_CGC_SYSOSC_DEFAULT;
MSTOP = 1U;
/* Set fMAIN */
MCM0 = 0U;
OSMC = _00_CGC_IT_CLK_NO;
/* Set fIH */
HIOSTOP = 0U;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

146
bl_zc/r_cg_cgc.h Normal file
View File

@ -0,0 +1,146 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_cgc.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef CGC_H
#define CGC_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Clock operation mode control register (CMC)
*/
/* High-speed system clock pin operation mode (EXCLK, OSCSEL) */
#define _C0_CGC_HISYS_PIN (0xC0U)
#define _00_CGC_HISYS_PORT (0x00U) /* X1, X2 as I/O port */
#define _40_CGC_HISYS_OSC (0x40U) /* X1, X2 as crystal/ceramic resonator connection */
#define _80_CGC_HISYS_PORT1 (0x80U) /* X1, X2 as I/O port */
#define _C0_CGC_HISYS_EXT (0xC0U) /* X1 as I/O port, X2 as external clock input */
/* Control of X1 high-speed system clock oscillation frequency (AMPH) */
#define _00_CGC_SYSOSC_DEFAULT (0x00U)
#define _00_CGC_SYSOSC_UNDER10M (0x00U) /* fX <= 10MHz */
#define _01_CGC_SYSOSC_OVER10M (0x01U) /* fX > 10MHz */
/*
Clock operation status control register (CSC)
*/
/* Control of high-speed system clock operation (MSTOP) */
#define _00_CGC_HISYS_OPER (0x00U) /* X1 oscillator/external clock operating */
#define _80_CGC_HISYS_STOP (0x80U) /* X1 oscillator/external clock stopped */
/* High-speed OCO operation (HIOSTOP) */
#define _00_CGC_HIO_OPER (0x00U) /* high-speed OCO operating */
#define _01_CGC_HIO_STOP (0x01U) /* high-speed OCO stopped */
/*
Oscillation stabilization time counter status register (OSTC)
*/
/* Oscillation stabilization time status (MOST18 - MOST8) */
#define _00_CGC_OSCSTAB_STA0 (0x00U) /* < 2^8/fX */
#define _80_CGC_OSCSTAB_STA8 (0x80U) /* 2^8/fX */
#define _C0_CGC_OSCSTAB_STA9 (0xC0U) /* 2^9/fX */
#define _E0_CGC_OSCSTAB_STA10 (0xE0U) /* 2^10/fX */
#define _F0_CGC_OSCSTAB_STA11 (0xF0U) /* 2^11/fX */
#define _F8_CGC_OSCSTAB_STA13 (0xF8U) /* 2^13/fX */
#define _FC_CGC_OSCSTAB_STA15 (0xFCU) /* 2^15/fX */
#define _FE_CGC_OSCSTAB_STA17 (0xFEU) /* 2^17/fX */
#define _FF_CGC_OSCSTAB_STA18 (0xFFU) /* 2^18/fX */
/*
Oscillation stabilization time select register (OSTS)
*/
/* Oscillation stabilization time selection (OSTS2 - OSTS0) */
#define _00_CGC_OSCSTAB_SEL8 (0x00U) /* 2^8/fX */
#define _01_CGC_OSCSTAB_SEL9 (0x01U) /* 2^9/fX */
#define _02_CGC_OSCSTAB_SEL10 (0x02U) /* 2^10/fX */
#define _03_CGC_OSCSTAB_SEL11 (0x03U) /* 2^11/fX */
#define _04_CGC_OSCSTAB_SEL13 (0x04U) /* 2^13/fX */
#define _05_CGC_OSCSTAB_SEL15 (0x05U) /* 2^15/fX */
#define _06_CGC_OSCSTAB_SEL17 (0x06U) /* 2^17/fX */
#define _07_CGC_OSCSTAB_SEL18 (0x07U) /* 2^18/fX */
/*
System clock control register (CKC)
*/
/* Status of Main system clock fMAIN (MCS) */
#define _00_CGC_MAINCLK_HIO (0x00U) /* high-speed OCO clock (fIH) */
#define _20_CGC_MAINCLK_HISYS (0x20U) /* high-speed system clock (fMX) */
/* Selection of Main system clock fMAIN (MCM0) */
#define _00_CGC_MAINCLK_SELHIO (0x00U) /* high-speed OCO clock (fIH) */
#define _10_CGC_MAINCLK_SELHISYS (0x10U) /* high-speed system clock (fMX) */
/*
Operation speed mode control register (OSMC)
*/
/* Interval timer unit input clock supply (WUTMMCK0) */
#define _00_CGC_IT_CLK_NO (0x00U) /* stop */
#define _10_CGC_IT_CLK_FIL (0x10U) /* use fIL clcok */
/*
Illegal memory access detection control register (IAWCTL)
*/
/* Illegal memory access detection control (IAWEN) */
#define _00_CGC_ILLEGAL_ACCESS_OFF (0x00U) /* disables illegal memory access detection */
#define _80_CGC_ILLEGAL_ACCESS_ON (0x80U) /* enables illegal memory access detection */
/* RAM guard area (GRAM1, GRAM0) */
#define _00_CGC_RAM_GUARD_OFF (0x00U) /* invalid, it is possible to write RAM */
#define _10_CGC_RAM_GUARD_ARAE0 (0x10U) /* 128 bytes from RAM bottom address */
#define _20_CGC_RAM_GUARD_ARAE1 (0x20U) /* 256 bytes from RAM bottom address */
#define _30_CGC_RAM_GUARD_ARAE2 (0x30U) /* 512 bytes from RAM bottom address */
/* PORT register guard (GPORT) */
#define _00_CGC_PORT_GUARD_OFF (0x00U) /* invalid, it is possible to write PORT register */
#define _04_CGC_PORT_GUARD_ON (0x04U) /* valid, it is impossible to write PORT register, but possible for read */
/* Interrupt register guard (GINT) */
#define _00_CGC_INT_GUARD_OFF (0x00U) /* invalid, it is possible to write interrupt register */
#define _02_CGC_INT_GUARD_ON (0x02U) /* valid, impossible to write interrupt register, but possible for read */
/* CSC register guard (GCSC) */
#define _00_CGC_CSC_GUARD_OFF (0x00U) /* invalid, it is possible to write CSC register */
#define _01_CGC_CSC_GUARD_ON (0x01U) /* valid, it is impossible to write CSC register, but possible for read */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
typedef enum
{
HIOCLK,
SYSX1CLK,
SYSEXTCLK
} clock_mode_t;
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_CGC_Create(void);
void R_CGC_Get_ResetSource(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

64
bl_zc/r_cg_cgc_user.c Normal file
View File

@ -0,0 +1,64 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_cgc_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_CGC_Get_ResetSource
* Description : This function process of Reset.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CGC_Get_ResetSource(void)
{
uint8_t reset_flag = RESF;
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

88
bl_zc/r_cg_macrodriver.h Normal file
View File

@ -0,0 +1,88 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_macrodriver.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements general head file.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef STATUS_H
#define STATUS_H
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "iodefine.h"
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
#define DI __DI
#define EI __EI
#define HALT __halt
#define NOP __nop
#define STOP __stop
#define BRK __brk
/* Status list definition */
#define MD_STATUSBASE (0x00U)
#define MD_OK (MD_STATUSBASE + 0x00U) /* register setting OK */
#define MD_SPT (MD_STATUSBASE + 0x01U) /* IIC stop */
#define MD_NACK (MD_STATUSBASE + 0x02U) /* IIC no ACK */
#define MD_BUSY1 (MD_STATUSBASE + 0x03U) /* busy 1 */
#define MD_BUSY2 (MD_STATUSBASE + 0x04U) /* busy 2 */
#define MD_OVERRUN (MD_STATUSBASE + 0x05U) /* IIC OVERRUN occur */
/* Error list definition */
#define MD_ERRORBASE (0x80U)
#define MD_ERROR (MD_ERRORBASE + 0x00U) /* error */
#define MD_ARGERROR (MD_ERRORBASE + 0x01U) /* error agrument input error */
#define MD_ERROR1 (MD_ERRORBASE + 0x02U) /* error 1 */
#define MD_ERROR2 (MD_ERRORBASE + 0x03U) /* error 2 */
#define MD_ERROR3 (MD_ERRORBASE + 0x04U) /* error 3 */
#define MD_ERROR4 (MD_ERRORBASE + 0x05U) /* error 4 */
#endif
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
#ifndef __TYPEDEF__
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
typedef unsigned short MD_STATUS;
#define __TYPEDEF__
#endif
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
#endif

71
bl_zc/r_cg_port.c Normal file
View File

@ -0,0 +1,71 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_port.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_port.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_PORT_Create
* Description : This function initializes the Port I/O.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_PORT_Create(void)
{
P2 = _00_Pn0_OUTPUT_0 | _00_Pn1_OUTPUT_0;
P4 = _00_Pn2_OUTPUT_0;
PMC1 = _00_PMCn0_DI_ON | _02_PMCn1_NOT_USE | _00_PMCn2_DI_ON | _08_PMCn3_NOT_USE | _00_PMCn4_DI_ON |
_E0_PMC1_DEFAULT;
PMC4 = _02_PMCn1_NOT_USE | _00_PMCn2_DI_ON | _F9_PMC4_DEFAULT;
ADPC = _01_ADPC_DI_ON;
PM1 = _01_PMn0_MODE_INPUT | _02_PMn1_NOT_USE | _04_PMn2_MODE_INPUT | _08_PMn3_NOT_USE | _10_PMn4_MODE_INPUT |
_E0_PM1_DEFAULT;
PM2 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _04_PMn2_NOT_USE | _08_PMn3_NOT_USE | _F0_PM2_DEFAULT;
PM4 = _01_PMn0_NOT_USE | _02_PMn1_NOT_USE | _00_PMn2_MODE_OUTPUT | _F8_PM4_DEFAULT;
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

200
bl_zc/r_cg_port.h Normal file
View File

@ -0,0 +1,200 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_port.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef PORT_H
#define PORT_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Port Mode Register (PMm)
*/
/* Pmn pin I/O mode selection (PMm7 - PMm0) */
#define _01_PMn0_NOT_USE (0x01U) /* not use Pn0 as digital I/O */
#define _01_PMn0_MODE_INPUT (0x01U) /* use Pn0 as input mode */
#define _00_PMn0_MODE_OUTPUT (0x00U) /* use Pn0 as output mode */
#define _02_PMn1_NOT_USE (0x02U) /* not use Pn1 as digital I/O */
#define _02_PMn1_MODE_INPUT (0x02U) /* use Pn1 as input mode */
#define _00_PMn1_MODE_OUTPUT (0x00U) /* use Pn1 as output mode */
#define _04_PMn2_NOT_USE (0x04U) /* not use Pn2 as digital I/O */
#define _04_PMn2_MODE_INPUT (0x04U) /* use Pn2 as input mode */
#define _00_PMn2_MODE_OUTPUT (0x00U) /* use Pn2 as output mode */
#define _08_PMn3_NOT_USE (0x08U) /* not use Pn3 as digital I/O */
#define _08_PMn3_MODE_INPUT (0x08U) /* use Pn3 as input mode */
#define _00_PMn3_MODE_OUTPUT (0x00U) /* use Pn3 as output mode */
#define _10_PMn4_NOT_USE (0x10U) /* not use Pn4 as digital I/O */
#define _10_PMn4_MODE_INPUT (0x10U) /* use Pn4 as input mode */
#define _00_PMn4_MODE_OUTPUT (0x00U) /* use Pn4 as output mode */
#define _20_PMn5_NOT_USE (0x20U) /* not use Pn5 as digital I/O */
#define _20_PMn5_MODE_INPUT (0x20U) /* use Pn5 as input mode */
#define _00_PMn5_MODE_OUTPUT (0x00U) /* use Pn5 as output mode */
#define _40_PMn6_NOT_USE (0x40U) /* not use Pn6 as digital I/O */
#define _40_PMn6_MODE_INPUT (0x40U) /* use Pn6 as input mode */
#define _00_PMn6_MODE_OUTPUT (0x00U) /* use Pn6 as output mode */
#define _80_PMn7_NOT_USE (0x80U) /* not use Pn7 as digital I/O */
#define _80_PMn7_MODE_INPUT (0x80U) /* use Pn7 as input mode */
#define _00_PMn7_MODE_OUTPUT (0x00U) /* use Pn7 as output mode */
/*
Port Register (Pm)
*/
/* Pmn pin data (Pm0 to Pm7) */
#define _00_Pn0_OUTPUT_0 (0x00U) /* Pn0 output 0 */
#define _01_Pn0_OUTPUT_1 (0x01U) /* Pn0 output 1 */
#define _00_Pn1_OUTPUT_0 (0x00U) /* Pn1 output 0 */
#define _02_Pn1_OUTPUT_1 (0x02U) /* Pn1 output 1 */
#define _00_Pn2_OUTPUT_0 (0x00U) /* Pn2 output 0 */
#define _04_Pn2_OUTPUT_1 (0x04U) /* Pn2 output 1 */
#define _00_Pn3_OUTPUT_0 (0x00U) /* Pn3 output 0 */
#define _08_Pn3_OUTPUT_1 (0x08U) /* Pn3 output 1 */
#define _00_Pn4_OUTPUT_0 (0x00U) /* Pn4 output 0 */
#define _10_Pn4_OUTPUT_1 (0x10U) /* Pn4 output 1 */
#define _00_Pn5_OUTPUT_0 (0x00U) /* Pn5 output 0 */
#define _20_Pn5_OUTPUT_1 (0x20U) /* Pn5 output 1 */
#define _00_Pn6_OUTPUT_0 (0x00U) /* Pn6 output 0 */
#define _40_Pn6_OUTPUT_1 (0x40U) /* Pn6 output 1 */
#define _00_Pn7_OUTPUT_0 (0x00U) /* Pn7 output 0 */
#define _80_Pn7_OUTPUT_1 (0x80U) /* Pn7 output 1 */
/*
Pull-up Resistor Option Register (PUm)
*/
/* Pmn pin on-chip pull-up resistor selection (PUmn) */
#define _00_PUn0_PULLUP_OFF (0x00U) /* Pn0 pull-up resistor not connected */
#define _01_PUn0_PULLUP_ON (0x01U) /* Pn0 pull-up resistor connected */
#define _00_PUn1_PULLUP_OFF (0x00U) /* Pn1 pull-up resistor not connected */
#define _02_PUn1_PULLUP_ON (0x02U) /* Pn1 pull-up resistor connected */
#define _00_PUn2_PULLUP_OFF (0x00U) /* Pn2 Pull-up resistor not connected */
#define _04_PUn2_PULLUP_ON (0x04U) /* Pn2 pull-up resistor connected */
#define _00_PUn3_PULLUP_OFF (0x00U) /* Pn3 pull-up resistor not connected */
#define _08_PUn3_PULLUP_ON (0x08U) /* Pn3 pull-up resistor connected */
#define _00_PUn4_PULLUP_OFF (0x00U) /* Pn4 pull-up resistor not connected */
#define _10_PUn4_PULLUP_ON (0x10U) /* Pn4 pull-up resistor connected */
#define _00_PUn5_PULLUP_OFF (0x00U) /* Pn5 pull-up resistor not connected */
#define _20_PUn5_PULLUP_ON (0x20U) /* Pn5 pull-up resistor connected */
#define _00_PUn6_PULLUP_OFF (0x00U) /* Pn6 pull-up resistor not connected */
#define _40_PUn6_PULLUP_ON (0x40U) /* Pn6 pull-up resistor connected */
#define _00_PUn7_PULLUP_OFF (0x00U) /* Pn7 pull-up resistor not connected */
#define _80_PUn7_PULLUP_ON (0x80U) /* Pn7 pull-up resistor connected */
/*
Port Input Mode Register (PIMm)
*/
/* Pmn pin input buffer selection (PIMmn) */
#define _00_PIMn0_TTL_OFF (0x00U) /* set Pn0 normal input buffer */
#define _01_PIMn0_TTL_ON (0x01U) /* set Pn0 TTL input buffer */
#define _00_PIMn1_TTL_OFF (0x00U) /* set Pn1 normal input buffer */
#define _02_PIMn1_TTL_ON (0x02U) /* set Pn1 TTL input buffer */
#define _00_PIMn2_TTL_OFF (0x00U) /* set Pn2 normal input buffer */
#define _04_PIMn2_TTL_ON (0x04U) /* set Pn2 TTL input buffer */
#define _00_PIMn3_TTL_OFF (0x00U) /* set Pn3 normal input buffer */
#define _08_PIMn3_TTL_ON (0x08U) /* set Pn3 TTL input buffer */
#define _00_PIMn4_TTL_OFF (0x00U) /* set Pn4 normal input buffer */
#define _10_PIMn4_TTL_ON (0x10U) /* set Pn4 TTL input buffer */
#define _00_PIMn5_TTL_OFF (0x00U) /* set Pn5 normal input buffer */
#define _20_PIMn5_TTL_ON (0x20U) /* set Pn5 TTL input buffer */
#define _00_PIMn6_TTL_OFF (0x00U) /* set Pn6 normal input buffer */
#define _40_PIMn6_TTL_ON (0x40U) /* set Pn6 TTL input buffer */
#define _00_PIMn7_TTL_OFF (0x00U) /* set Pn7 normal input buffer */
#define _80_PIMn7_TTL_ON (0x80U) /* set Pn7 TTL input buffer */
/*
Port Output Mode Register (POMm)
*/
/* Pmn pin output mode selection (POMmn) */
#define _00_POMn0_NCH_OFF (0x00U) /* set Pn0 output normal mode */
#define _01_POMn0_NCH_ON (0x01U) /* set Pn0 output N-ch open-drain mode */
#define _00_POMn1_NCH_OFF (0x00U) /* set Pn1 output normal mode */
#define _02_POMn1_NCH_ON (0x02U) /* set Pn1 output N-ch open-drain mode */
#define _00_POMn2_NCH_OFF (0x00U) /* set Pn2 output normal mode */
#define _04_POMn2_NCH_ON (0x04U) /* set Pn2 output N-ch open-drain mode */
#define _00_POMn3_NCH_OFF (0x00U) /* set Pn3 output normal mode */
#define _08_POMn3_NCH_ON (0x08U) /* set Pn3 output N-ch open-drain mode */
#define _00_POMn4_NCH_OFF (0x00U) /* set Pn4 output normal mode */
#define _10_POMn4_NCH_ON (0x10U) /* set Pn4 output N-ch open-drain mode */
#define _00_POMn5_NCH_OFF (0x00U) /* set Pn5 output normal mode */
#define _20_POMn5_NCH_ON (0x20U) /* set Pn5 output N-ch open-drain mode */
#define _00_POMn6_NCH_OFF (0x00U) /* set Pn6 output normal mode */
#define _40_POMn6_NCH_ON (0x40U) /* set Pn6 output N-ch open-drain mode */
#define _00_POMn7_NCH_OFF (0x00U) /* set Pn7 output normal mode */
#define _80_POMn7_NCH_ON (0x80U) /* set Pn7 output N-ch open-drain mode */
/*
Port Operation Mode Register (PMCm)
*/
/* Pmn pin digital input buffer selection (PMCmn) */
#define _01_PMCn0_NOT_USE (0x01U) /* not use Pn0 digital input */
#define _00_PMCn0_DI_ON (0x00U) /* enable Pn0 digital input */
#define _02_PMCn1_NOT_USE (0x02U) /* not use Pn1 digital input */
#define _00_PMCn1_DI_ON (0x00U) /* enable Pn1 digital input */
#define _04_PMCn2_NOT_USE (0x04U) /* not use Pn2 digital input */
#define _00_PMCn2_DI_ON (0x00U) /* enable Pn2 digital input */
#define _08_PMCn3_NOT_USE (0x08U) /* not use Pn3 digital input */
#define _00_PMCn3_DI_ON (0x00U) /* enable Pn3 digital input */
#define _10_PMCn4_NOT_USE (0x10U) /* not use Pn4 digital input */
#define _00_PMCn4_DI_ON (0x00U) /* enable Pn4 digital input */
#define _20_PMCn5_NOT_USE (0x20U) /* not use Pn5 digital input */
#define _00_PMCn5_DI_ON (0x00U) /* enable Pn5 digital input */
#define _40_PMCn6_NOT_USE (0x40U) /* not use Pn6 digital input */
#define _00_PMCn6_DI_ON (0x00U) /* enable Pn6 digital input */
#define _80_PMCn7_NOT_USE (0x80U) /* not use Pn7 digital input */
#define _00_PMCn7_DI_ON (0x00U) /* enable Pn7 digital input */
/*
AD port configuration register (ADPC)
*/
/* Analog input/digital input switching (ADPC3 - ADPC0) */
#define _00_ADPC_DI_OFF (0x00U) /* use P20 - P23 as analog input */
#define _04_ADPC_DI_ON (0x04U) /* use P23 as digital input */
#define _03_ADPC_DI_ON (0x03U) /* use P22 - P23 as digital input */
#define _02_ADPC_DI_ON (0x02U) /* use P21 - P23 as digital input */
#define _01_ADPC_DI_ON (0x01U) /* use P20 - P23 as digital input */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
#define _E0_PM1_DEFAULT (0xE0U) /* PM1 default value */
#define _F0_PM2_DEFAULT (0xF0U) /* PM2 default value */
#define _F8_PM4_DEFAULT (0xF8U) /* PM4 default value */
#define _FC_PM6_DEFAULT (0xFCU) /* PM6 default value */
#define _E0_PMC1_DEFAULT (0xE0U) /* PMC1 default value */
#define _F9_PMC4_DEFAULT (0xF9U) /* PMC4 default value */
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_PORT_Create(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

51
bl_zc/r_cg_port_user.c Normal file
View File

@ -0,0 +1,51 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_port_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_port.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

158
bl_zc/r_cg_timer.c Normal file
View File

@ -0,0 +1,158 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_TAU0_Create
* Description : This function initializes the TAU0 module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Create(void)
{
TAU0EN = 1U; /* supplies input clock */
TPS0 = _0000_TAU_CKM0_FCLK_0 | _0000_TAU_CKM1_FCLK_0 | _0000_TAU_CKM2_FCLK_1 | _0000_TAU_CKM3_FCLK_8;
/* Stop all channels */
TT0 = _0001_TAU_CH0_STOP_TRG_ON | _0002_TAU_CH1_STOP_TRG_ON | _0004_TAU_CH2_STOP_TRG_ON |
_0008_TAU_CH3_STOP_TRG_ON | _0200_TAU_CH1_H8_STOP_TRG_ON | _0800_TAU_CH3_H8_STOP_TRG_ON;
/* Mask channel 0 interrupt */
TMMK00 = 1U; /* disable INTTM00 interrupt */
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
/* Mask channel 1 interrupt */
TMMK01 = 1U; /* disable INTTM01 interrupt */
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
/* Mask channel 1 higher 8 bits interrupt */
TMMK01H = 1U; /* disable INTTM01H interrupt */
TMIF01H = 0U; /* clear INTTM01H interrupt flag */
/* Mask channel 2 interrupt */
TMMK02 = 1U; /* disable INTTM02 interrupt */
TMIF02 = 0U; /* clear INTTM02 interrupt flag */
/* Mask channel 3 interrupt */
TMMK03 = 1U; /* disable INTTM03 interrupt */
TMIF03 = 0U; /* clear INTTM03 interrupt flag */
/* Mask channel 3 higher 8 bits interrupt */
TMMK03H = 1U; /* disable INTTM03H interrupt */
TMIF03H = 0U; /* clear INTTM03H interrupt flag */
/* Set INTTM00 low priority */
TMPR100 = 1U;
TMPR000 = 1U;
/* Set INTTM01 low priority */
TMPR101 = 1U;
TMPR001 = 1U;
/* Channel 0 used as interval timer */
TMR00 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_COMBINATION_SLAVE |
_0000_TAU_TRIGGER_SOFTWARE | _0000_TAU_MODE_INTERVAL_TIMER | _0000_TAU_START_INT_UNUSED;
TDR00 = _5DBF_TAU_TDR00_VALUE;
TO0 &= ~_0001_TAU_CH0_OUTPUT_VALUE_1;
TOE0 &= ~_0001_TAU_CH0_OUTPUT_ENABLE;
/* Channel 1 used as interval timer */
TMR01 = _0000_TAU_CLOCK_SELECT_CKM0 | _0000_TAU_CLOCK_MODE_CKS | _0000_TAU_16BITS_MODE |
_0000_TAU_TRIGGER_SOFTWARE | _0000_TAU_MODE_INTERVAL_TIMER | _0000_TAU_START_INT_UNUSED;
TDR01 = _BB7F_TAU_TDR01_VALUE;
TOM0 &= ~_0002_TAU_CH1_OUTPUT_COMBIN;
TOL0 &= ~_0002_TAU_CH1_OUTPUT_LEVEL_L;
TO0 &= ~_0002_TAU_CH1_OUTPUT_VALUE_1;
TOE0 &= ~_0002_TAU_CH1_OUTPUT_ENABLE;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel0_Start
* Description : This function starts TAU0 channel 0 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel0_Start(void)
{
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
TMMK00 = 0U; /* enable INTTM00 interrupt */
TS0 |= _0001_TAU_CH0_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel0_Stop
* Description : This function stops TAU0 channel 0 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel0_Stop(void)
{
TT0 |= _0001_TAU_CH0_STOP_TRG_ON;
/* Mask channel 0 interrupt */
TMMK00 = 1U; /* disable INTTM00 interrupt */
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel1_Start
* Description : This function starts TAU0 channel 1 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel1_Start(void)
{
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
TMMK01 = 0U; /* enable INTTM01 interrupt */
TS0 |= _0002_TAU_CH1_START_TRG_ON;
}
/***********************************************************************************************************************
* Function Name: R_TAU0_Channel1_Stop
* Description : This function stops TAU0 channel 1 counter.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_TAU0_Channel1_Stop(void)
{
TT0 |= _0002_TAU_CH1_STOP_TRG_ON;
/* Mask channel 1 interrupt */
TMMK01 = 1U; /* disable INTTM01 interrupt */
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

321
bl_zc/r_cg_timer.h Normal file
View File

@ -0,0 +1,321 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef TAU_H
#define TAU_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/*
Peripheral Enable Register 0 (PER0)
*/
/* Control of timer array unit 0 input clock (TAU0EN) */
#define _00_TAU0_CLOCK_STOP (0x00U) /* stops supply of input clock */
#define _01_TAU0_CLOCK_SUPPLY (0x01U) /* supplies input clock */
/*
Timer Clock Select Register m (TPSm)
*/
/* Operating mode and clear mode selection (PRSm03 - PRSm00) */
#define _0000_TAU_CKM0_FCLK_0 (0x0000U) /* ckm0 - fCLK */
#define _0001_TAU_CKM0_FCLK_1 (0x0001U) /* ckm0 - fCLK/2^1 */
#define _0002_TAU_CKM0_FCLK_2 (0x0002U) /* ckm0 - fCLK/2^2 */
#define _0003_TAU_CKM0_FCLK_3 (0x0003U) /* ckm0 - fCLK/2^3 */
#define _0004_TAU_CKM0_FCLK_4 (0x0004U) /* ckm0 - fCLK/2^4 */
#define _0005_TAU_CKM0_FCLK_5 (0x0005U) /* ckm0 - fCLK/2^5 */
#define _0006_TAU_CKM0_FCLK_6 (0x0006U) /* ckm0 - fCLK/2^6 */
#define _0007_TAU_CKM0_FCLK_7 (0x0007U) /* ckm0 - fCLK/2^7 */
#define _0008_TAU_CKM0_FCLK_8 (0x0008U) /* ckm0 - fCLK/2^8 */
#define _0009_TAU_CKM0_FCLK_9 (0x0009U) /* ckm0 - fCLK/2^9 */
#define _000A_TAU_CKM0_FCLK_10 (0x000AU) /* ckm0 - fCLK/2^10 */
#define _000B_TAU_CKM0_FCLK_11 (0x000BU) /* ckm0 - fCLK/2^11 */
#define _000C_TAU_CKM0_FCLK_12 (0x000CU) /* ckm0 - fCLK/2^12 */
#define _000D_TAU_CKM0_FCLK_13 (0x000DU) /* ckm0 - fCLK/2^13 */
#define _000E_TAU_CKM0_FCLK_14 (0x000EU) /* ckm0 - fCLK/2^14 */
#define _000F_TAU_CKM0_FCLK_15 (0x000FU) /* ckm0 - fCLK/2^15 */
/* Operating mode and clear mode selection (PRSm13 - PRSm10) */
#define _0000_TAU_CKM1_FCLK_0 (0x0000U) /* ckm1 - fCLK */
#define _0010_TAU_CKM1_FCLK_1 (0x0010U) /* ckm1 - fCLK/2^1 */
#define _0020_TAU_CKM1_FCLK_2 (0x0020U) /* ckm1 - fCLK/2^2 */
#define _0030_TAU_CKM1_FCLK_3 (0x0030U) /* ckm1 - fCLK/2^3 */
#define _0040_TAU_CKM1_FCLK_4 (0x0040U) /* ckm1 - fCLK/2^4 */
#define _0050_TAU_CKM1_FCLK_5 (0x0050U) /* ckm1 - fCLK/2^5 */
#define _0060_TAU_CKM1_FCLK_6 (0x0060U) /* ckm1 - fCLK/2^6 */
#define _0070_TAU_CKM1_FCLK_7 (0x0070U) /* ckm1 - fCLK/2^7 */
#define _0080_TAU_CKM1_FCLK_8 (0x0080U) /* ckm1 - fCLK/2^8 */
#define _0090_TAU_CKM1_FCLK_9 (0x0090U) /* ckm1 - fCLK/2^9 */
#define _00A0_TAU_CKM1_FCLK_10 (0x00A0U) /* ckm1 - fCLK/2^10 */
#define _00B0_TAU_CKM1_FCLK_11 (0x00B0U) /* ckm1 - fCLK/2^11 */
#define _00C0_TAU_CKM1_FCLK_12 (0x00C0U) /* ckm1 - fCLK/2^12 */
#define _00D0_TAU_CKM1_FCLK_13 (0x00D0U) /* ckm1 - fCLK/2^13 */
#define _00E0_TAU_CKM1_FCLK_14 (0x00E0U) /* ckm1 - fCLK/2^14 */
#define _00F0_TAU_CKM1_FCLK_15 (0x00F0U) /* ckm1 - fCLK/2^15 */
/* Operating mode and clear mode selection (PRSm21 - PRSm20) */
#define _0000_TAU_CKM2_FCLK_1 (0x0000U) /* ckm2 - fCLK/2^1 */
#define _0100_TAU_CKM2_FCLK_2 (0x0100U) /* ckm2 - fCLK/2^2 */
#define _0200_TAU_CKM2_FCLK_4 (0x0200U) /* ckm2 - fCLK/2^4 */
#define _0300_TAU_CKM2_FCLK_6 (0x0300U) /* ckm2 - fCLK/2^6 */
/* Operating mode and clear mode selection (PRSm31 - PRSm30) */
#define _0000_TAU_CKM3_FCLK_8 (0x0000U) /* ckm2 - fCLK/2^8 */
#define _1000_TAU_CKM3_FCLK_10 (0x1000U) /* ckm2 - fCLK/2^10 */
#define _2000_TAU_CKM3_FCLK_12 (0x2000U) /* ckm2 - fCLK/2^12 */
#define _3000_TAU_CKM3_FCLK_14 (0x3000U) /* ckm2 - fCLK/2^14 */
/*
Timer Mode Register mn (TMRmn)
*/
/* Selection of macro clock (MCK) of channel n (CKSmn1 - CKSmn0) */
#define _0000_TAU_CLOCK_SELECT_CKM0 (0x0000U) /* operation clock CK0 set by PRS register */
#define _8000_TAU_CLOCK_SELECT_CKM1 (0x8000U) /* operation clock CK1 set by PRS register */
#define _4000_TAU_CLOCK_SELECT_CKM2 (0x4000U) /* operation clock CK2 set by PRS register */
#define _C000_TAU_CLOCK_SELECT_CKM3 (0xC000U) /* operation clock CK3 set by PRS register */
/* Selection of count clock (CCK) of channel n (CCSmn) */
#define _0000_TAU_CLOCK_MODE_CKS (0x0000U) /* macro clock MCK specified by CKSmn bit */
#define _1000_TAU_CLOCK_MODE_TIMN (0x1000U) /* valid edge of input signal input from TImn pin */
/* Selection of slave/master of channel n (MASTERmn) */
#define _0000_TAU_COMBINATION_SLAVE (0x0000U) /* operates as slave channel */
#define _0000_TAU_COMBINATION_MASTER (0x0000U) /* channel0 operates as master channel */
#define _0800_TAU_COMBINATION_MASTER (0x0800U) /* channel2, 4, 6 operates as master channel */
/* Operation explanation of channel 1 or 3 (SPLIT) */
#define _0000_TAU_16BITS_MODE (0x0000U) /* operates as 16 bits timer */
#define _0800_TAU_8BITS_MODE (0x0800U) /* operates as 8 bits timer */
/* Setting of start trigger or capture trigger of channel n (STSmn2 - STSmn0) */
#define _0000_TAU_TRIGGER_SOFTWARE (0x0000U) /* only software trigger start is valid */
#define _0100_TAU_TRIGGER_TIMN_VALID (0x0100U) /* TImn input edge is used as a start/capture trigger */
#define _0200_TAU_TRIGGER_TIMN_BOTH (0x0200U) /* TImn input edges are used as a start/capture trigger */
#define _0400_TAU_TRIGGER_MASTER_INT (0x0400U) /* interrupt signal of the master channel is used */
/* Selection of TImn pin input valid edge (CISmn1 - CISmn0) */
#define _0000_TAU_TIMN_EDGE_FALLING (0x0000U) /* falling edge */
#define _0040_TAU_TIMN_EDGE_RISING (0x0040U) /* rising edge */
#define _0080_TAU_TIMN_EDGE_BOTH_LOW (0x0080U) /* both edges (when low-level width is measured) */
#define _00C0_TAU_TIMN_EDGE_BOTH_HIGH (0x00C0U) /* both edges (when high-level width is measured) */
/* Operation mode of channel n (MDmn3 - MDmn0) */
#define _0000_TAU_MODE_INTERVAL_TIMER (0x0000U) /* interval timer mode */
#define _0004_TAU_MODE_CAPTURE (0x0004U) /* capture mode */
#define _0006_TAU_MODE_EVENT_COUNT (0x0006U) /* event counter mode */
#define _0008_TAU_MODE_ONE_COUNT (0x0008U) /* one count mode */
#define _000C_TAU_MODE_HIGHLOW_MEASURE (0x000CU) /* high-/low-level width measurement mode */
#define _0001_TAU_MODE_PWM_MASTER (0x0001U) /* PWM Function (Master Channel) mode */
#define _0009_TAU_MODE_PWM_SLAVE (0x0009U) /* PWM Function (Slave Channel) mode */
#define _0008_TAU_MODE_ONESHOT (0x0008U) /* one-shot pulse output mode */
/* Setting of starting counting and interrupt (MDmn0) */
#define _0000_TAU_START_INT_UNUSED (0x0000U) /* interrupt is not generated when counting is started */
#define _0001_TAU_START_INT_USED (0x0001U) /* interrupt is generated when counting is started */
/*
Timer Status Register mn (TSRmn)
*/
/* Counter overflow status of channel n (OVF) */
#define _0000_TAU_OVERFLOW_NOT_OCCURS (0x0000U) /* overflow does not occur */
#define _0001_TAU_OVERFLOW_OCCURS (0x0001U) /* overflow occurs */
/*
Timer Channel Enable Status Register m (TEm)
*/
/* Indication of operation enable/stop status of channel 0 (TEm0) */
#define _0000_TAU_CH0_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0001_TAU_CH0_OPERATION_ENABLE (0x0001U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 1 (TEm1) */
#define _0000_TAU_CH1_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0002_TAU_CH1_OPERATION_ENABLE (0x0002U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 2 (TEm2) */
#define _0000_TAU_CH2_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0004_TAU_CH2_OPERATION_ENABLE (0x0004U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 3 (TEm3) */
#define _0000_TAU_CH3_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0008_TAU_CH3_OPERATION_ENABLE (0x0008U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 1 higher 8 bits (TEHm1) */
#define _0000_TAU_CH1_H8_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0200_TAU_CH1_H8_OPERATION_ENABLE (0x0200U) /* operation is enabled */
/* Indication of operation enable/stop status of channel 3 higher 8 bits (TEHm3) */
#define _0000_TAU_CH3_H8_OPERATION_STOP (0x0000U) /* operation is stopped */
#define _0800_TAU_CH3_H8_OPERATION_ENABLE (0x0800U) /* operation is enabled */
/*
Timer Channel Start Register m (TSm)
*/
/* Operation enable (start) trigger of channel 0 (TSm0) */
#define _0000_TAU_CH0_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0001_TAU_CH0_START_TRG_ON (0x0001U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 1 (TSm1) */
#define _0000_TAU_CH1_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0002_TAU_CH1_START_TRG_ON (0x0002U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 2 (TSm2) */
#define _0000_TAU_CH2_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0004_TAU_CH2_START_TRG_ON (0x0004U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 3 (TSm3) */
#define _0000_TAU_CH3_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0008_TAU_CH3_START_TRG_ON (0x0008U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 1 higher 8 bits (TSHm1) */
#define _0000_TAU_CH1_H8_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0200_TAU_CH1_H8_START_TRG_ON (0x0200U) /* operation is enabled (start trigger is generated) */
/* Operation enable (start) trigger of channel 3 higher 8 bits (TSHm3) */
#define _0000_TAU_CH3_H8_START_TRG_OFF (0x0000U) /* no trigger operation */
#define _0800_TAU_CH3_H8_START_TRG_ON (0x0800U) /* operation is enabled (start trigger is generated) */
/*
Timer Channel Stop Register m (TTm)
*/
/* Operation stop trigger of channel 0 (TTm0) */
#define _0000_TAU_CH0_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0001_TAU_CH0_STOP_TRG_ON (0x0001U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 1 (TTm1) */
#define _0000_TAU_CH1_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0002_TAU_CH1_STOP_TRG_ON (0x0002U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 2 (TTm2) */
#define _0000_TAU_CH2_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0004_TAU_CH2_STOP_TRG_ON (0x0004U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 3 (TTm3) */
#define _0000_TAU_CH3_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0008_TAU_CH3_STOP_TRG_ON (0x0008U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 1 higher 8 bits (TTHm1) */
#define _0000_TAU_CH1_H8_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0200_TAU_CH1_H8_STOP_TRG_ON (0x0200U) /* operation is stopped (stop trigger is generated) */
/* Operation stop trigger of channel 3 higher 8 bits (TTHm3) */
#define _0000_TAU_CH3_H8_STOP_TRG_OFF (0x0000U) /* no trigger operation */
#define _0800_TAU_CH3_H8_STOP_TRG_ON (0x0800U) /* operation is stopped (stop trigger is generated) */
/*
Timer Input Select Register m (TIS0)
*/
/* Selection of timer input used with channel 1 (TIS01 - TIS00) */
#define _00_TAU_CH1_INPUT_TI01 (0x00U) /* input signal of timer input pin (TI01) */
#define _01_TAU_CH1_INPUT_FIL (0x01U) /* internal low speed oscillation colock (fIL) */
#define _10_TAU_CH1_INPUT_TI01 (0x10U) /* input signal of timer input pin (TI01) */
/*
Timer Output Enable Register m (TOEm)
*/
/* Timer output enable/disable of channel 0 (TOEm0) */
#define _0001_TAU_CH0_OUTPUT_ENABLE (0x0001U) /* the TOm0 operation enabled by count operation */
#define _0000_TAU_CH0_OUTPUT_DISABLE (0x0000U) /* the TOm0 operation stopped by count operation */
/* Timer output enable/disable of channel 1 (TOEm1) */
#define _0002_TAU_CH1_OUTPUT_ENABLE (0x0002U) /* the TOm1 operation enabled by count operation */
#define _0000_TAU_CH1_OUTPUT_DISABLE (0x0000U) /* the TOm1 operation stopped by count operation */
/* Timer output enable/disable of channel 2 (TOEm2) */
#define _0004_TAU_CH2_OUTPUT_ENABLE (0x0004U) /* the TOm2 operation enabled by count operation */
#define _0000_TAU_CH2_OUTPUT_DISABLE (0x0000U) /* the TOm2 operation stopped by count operation */
/* Timer output enable/disable of channel 3 (TOEm3) */
#define _0008_TAU_CH3_OUTPUT_ENABLE (0x0008U) /* the TOm3 operation enabled by count operation */
#define _0000_TAU_CH3_OUTPUT_DISABLE (0x0000U) /* the TOm3 operation stopped by count operation */
/*
Timer Output Register m (TOm)
*/
/* Timer output of channel 0 (TOm0) */
#define _0000_TAU_CH0_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0001_TAU_CH0_OUTPUT_VALUE_1 (0x0001U) /* timer output value is "1" */
/* Timer output of channel 1 (TOm1) */
#define _0000_TAU_CH1_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0002_TAU_CH1_OUTPUT_VALUE_1 (0x0002U) /* timer output value is "1" */
/* Timer output of channel 2 (TOm2) */
#define _0000_TAU_CH2_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0004_TAU_CH2_OUTPUT_VALUE_1 (0x0004U) /* timer output value is "1" */
/* Timer output of channel 3 (TOm3) */
#define _0000_TAU_CH3_OUTPUT_VALUE_0 (0x0000U) /* timer output value is "0" */
#define _0008_TAU_CH3_OUTPUT_VALUE_1 (0x0008U) /* timer output value is "1" */
/*
Timer Output Level Register 0 (TOLm)
*/
/* Control of timer output level of channel 1 (TOLm1) */
#define _0000_TAU_CH1_OUTPUT_LEVEL_H (0x0000U) /* positive logic output (active-high) */
#define _0002_TAU_CH1_OUTPUT_LEVEL_L (0x0002U) /* inverted output (active-low) */
/* Control of timer output level of channel 2 (TOLm2) */
#define _0000_TAU_CH2_OUTPUT_LEVEL_H (0x0000U) /* positive logic output (active-high) */
#define _0004_TAU_CH2_OUTPUT_LEVEL_L (0x0004U) /* inverted output (active-low) */
/* Control of timer output level of channel 3 (TOLm3) */
#define _0000_TAU_CH3_OUTPUT_LEVEL_H (0x0000U) /* positive logic output (active-high) */
#define _0008_TAU_CH3_OUTPUT_LEVEL_L (0x0008U) /* inverted output (active-low) */
/*
Timer Output Mode Register m (TOMm)
*/
/* Control of timer output mode of channel 1 (TOMm1) */
#define _0000_TAU_CH1_OUTPUT_TOGGLE (0x0000U) /* toggle operation mode */
#define _0002_TAU_CH1_OUTPUT_COMBIN (0x0002U) /* combination operation mode */
/* Control of timer output mode of channel 2 (TOMm2) */
#define _0000_TAU_CH2_OUTPUT_TOGGLE (0x0000U) /* toggle operation mode */
#define _0004_TAU_CH2_OUTPUT_COMBIN (0x0004U) /* combination operation mode */
/* Control of timer output mode of channel 3 (TOMm3) */
#define _0000_TAU_CH3_OUTPUT_TOGGLE (0x0000U) /* toggle operation mode */
#define _0008_TAU_CH3_OUTPUT_COMBIN (0x0008U) /* combination operation mode */
/*
Input Switch Control Register (ISC)
*/
/* Switching channel 7 input of timer array unit (ISC1) */
#define _00_TAU_CH7_NO_INPUT (0x00U) /* timer input is not used */
#define _02_TAU_CH7_RXD3_INPUT (0x02U) /* input signal of RxD3 pin is used as timer input */
/*
Noise Filter Enable Register 1 (NFEN1)
*/
/* Enable/disable using noise filter of TI03 pin input signal (TNFEN03) */
#define _00_TAU_CH3_NOISE_OFF (0x00U) /* noise filter OFF */
#define _08_TAU_CH3_NOISE_ON (0x08U) /* noise filter ON */
/* Enable/disable using noise filter of TI02 pin input signal (TNFEN02) */
#define _00_TAU_CH2_NOISE_OFF (0x00U) /* noise filter OFF */
#define _04_TAU_CH2_NOISE_ON (0x04U) /* noise filter ON */
/* Enable/disable using noise filter of TI01 pin input signal (TNFEN01) */
#define _00_TAU_CH1_NOISE_OFF (0x00U) /* noise filter OFF */
#define _02_TAU_CH1_NOISE_ON (0x02U) /* noise filter ON */
/* Enable/disable using noise filter of TI00 pin input signal (TNFEN00) */
#define _00_TAU_CH0_NOISE_OFF (0x00U) /* noise filter OFF */
#define _01_TAU_CH0_NOISE_ON (0x01U) /* noise filter ON */
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/* 16-bit timer data register 00 (TDR00) */
#define _5DBF_TAU_TDR00_VALUE (0x5DBFU)
/* Clock divisor for TAU0 channel 0 */
#define _0001_TAU0_CHANNEL0_DIVISOR (0x0001U)
/* 16-bit timer data register 01 (TDR01) */
#define _BB7F_TAU_TDR01_VALUE (0xBB7FU)
/* Clock divisor for TAU0 channel 1 */
#define _0001_TAU0_CHANNEL1_DIVISOR (0x0001U)
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_TAU0_Create(void);
void R_TAU0_Channel0_Start(void);
void R_TAU0_Channel0_Stop(void);
void R_TAU0_Channel1_Start(void);
void R_TAU0_Channel1_Stop(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

79
bl_zc/r_cg_timer_user.c Normal file
View File

@ -0,0 +1,79 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_timer_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
#include "event.h"
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_tau0_channel0_interrupt(vect=INTTM00)
#pragma interrupt r_tau0_channel1_interrupt(vect=INTTM01)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_tau0_channel0_interrupt
* Description : This function is INTTM00 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_tau0_channel0_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
TimeBaseCount();
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: r_tau0_channel1_interrupt
* Description : This function is INTTM01 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_tau0_channel1_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

38
bl_zc/r_cg_userdefine.h Normal file
View File

@ -0,0 +1,38 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_userdefine.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file includes user definition.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef _USER_DEF_H
#define _USER_DEF_H
/***********************************************************************************************************************
User definitions
***********************************************************************************************************************/
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

78
bl_zc/r_cg_wdt.c Normal file
View File

@ -0,0 +1,78 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_wdt.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_WDT_Create
* Description : This function initializes the watchdogtimer.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_WDT_Create(void)
{
WDTIMK = 1U; /* disable INTWDTI interrupt */
WDTIIF = 0U; /* clear INTWDTI interrupt flag */
/* Set INTWDTI low priority */
WDTIPR1 = 1U;
WDTIPR0 = 1U;
WDTIMK = 0U; /* enable INTWDTI interrupt */
}
/***********************************************************************************************************************
* Function Name: R_WDT_Restart
* Description : This function restarts the watchdog timer.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_WDT_Restart(void)
{
WDTE = 0xACU; /* restart watchdog timer */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

52
bl_zc/r_cg_wdt.h Normal file
View File

@ -0,0 +1,52 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_wdt.h
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
#ifndef WDT_H
#define WDT_H
/***********************************************************************************************************************
Macro definitions (Register bit)
***********************************************************************************************************************/
/***********************************************************************************************************************
Macro definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Typedef definitions
***********************************************************************************************************************/
/***********************************************************************************************************************
Global functions
***********************************************************************************************************************/
void R_WDT_Create(void);
void R_WDT_Restart(void);
/* Start user code for function. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#endif

64
bl_zc/r_cg_wdt_user.c Normal file
View File

@ -0,0 +1,64 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_wdt_user.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
#pragma interrupt r_wdt_interrupt(vect=INTWDTI)
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: r_wdt_interrupt
* Description : This function is INTWDTI interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
static void __near r_wdt_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

90
bl_zc/r_main.c Normal file
View File

@ -0,0 +1,90 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_main.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements main function.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_adc.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
#include "appTask.h"
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
void R_MAIN_UserInit(void);
/***********************************************************************************************************************
* Function Name: main
* Description : This function implements main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void main(void)
{
R_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
HardWare_Init();
Variable_Init();
while (1U)
{
AppTask();
}
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: R_MAIN_UserInit
* Description : This function adds user code before implementing main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_MAIN_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
EI();
/* End user code. Do not edit comment generated here */
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

86
bl_zc/r_systeminit.c Normal file
View File

@ -0,0 +1,86 @@
/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
* LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
* ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
* of this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2021 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_systeminit.c
* Version : CodeGenerator for RL78/G12 V2.04.06.02 [08 Nov 2021]
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements system initializing function.
* Creation Date: 2022/5/1
***********************************************************************************************************************/
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_adc.h"
#include "r_cg_timer.h"
#include "r_cg_wdt.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_Systeminit
* Description : This function initializes every macro.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_Systeminit(void)
{
PIOR = 0x00U;
R_CGC_Get_ResetSource();
R_CGC_Create();
R_PORT_Create();
R_ADC_Create();
R_TAU0_Create();
R_WDT_Create();
IAWCTL = 0x00U;
}
/***********************************************************************************************************************
* Function Name: hdwinit
* Description : This function initializes hardware setting.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void hdwinit(void)
{
DI();
R_Systeminit();
}
/* Start user code for adding. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */

77
bl_zc/stkinit.asm Normal file
View File

@ -0,0 +1,77 @@
;/**********************************************************************************************************************
; * DISCLAIMER
; * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No
; * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
; * applicable laws, including copyright laws.
; * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
; * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
; * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM
; * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES
; * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO
; * THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
; * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
; * this software. By using this software, you agree to the additional terms and conditions found by accessing the
; * following link:
; * http://www.renesas.com/disclaimer
; *
; * Copyright (C) 2020 Renesas Electronics Corporation. All rights reserved.
; *********************************************************************************************************************/;---------------------------------------------------------------------
; _stkinit
;
; void _stkinit(void __near * stackbss);
;
; input:
; stackbss = AX (#LOWW(_stackend))
; output:
; NONE
;---------------------------------------------------------------------
; NOTE : THIS IS A TYPICAL EXAMPLE.
.PUBLIC _stkinit
.textf .CSEG TEXTF
_stkinit:
MOVW HL,AX ; stack_end_addr
MOV [SP+3],#0x00 ; [SP+0]-[SP+2] for return address
MOVW AX,SP
SUBW AX,HL ; SUBW AX,#LOWW _@STEND
BNH $LSTINIT3 ; goto end
SHRW AX,5 ; loop count for 32 byte transfer
MOVW BC,AX
CLRW AX
LSTINIT1:
CMPW AX,BC
BZ $LSTINIT2
MOVW [HL],AX
MOVW [HL+2],AX
MOVW [HL+4],AX
MOVW [HL+6],AX
MOVW [HL+8],AX
MOVW [HL+10],AX
MOVW [HL+12],AX
MOVW [HL+14],AX
MOVW [HL+16],AX
MOVW [HL+18],AX
MOVW [HL+20],AX
MOVW [HL+22],AX
MOVW [HL+24],AX
MOVW [HL+26],AX
MOVW [HL+28],AX
MOVW [HL+30],AX
XCHW AX,HL
ADDW AX,#0x20
XCHW AX,HL
DECW BC
BR $LSTINIT1
LSTINIT2:
MOVW AX,SP
CMPW AX,HL
BZ $LSTINIT3 ; goto end
CLRW AX
MOVW [HL],AX
INCW HL
INCW HL
BR $LSTINIT2
LSTINIT3:
RET