Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "C8051F120.h"
- sbit LED=P1^6;
- cnt=0x5;
- void Reset_Sources_Init()
- {
- WDTCN = 0xDE;
- WDTCN = 0xAD;
- }
- void Timer_Init()
- {
- SFRPAGE = TIMER01_PAGE;
- TCON = 0x10;
- TMOD = 0x01;
- }
- void Port_IO_Init()
- {
- // P0.0 - Unassigned, Open-Drain, Digital
- // P0.1 - Unassigned, Open-Drain, Digital
- // P0.2 - Unassigned, Open-Drain, Digital
- // P0.3 - Unassigned, Open-Drain, Digital
- // P0.4 - Unassigned, Open-Drain, Digital
- // P0.5 - Unassigned, Open-Drain, Digital
- // P0.6 - Unassigned, Open-Drain, Digital
- // P0.7 - Unassigned, Open-Drain, Digital
- // P1.0 - Unassigned, Open-Drain, Digital
- // P1.1 - Unassigned, Open-Drain, Digital
- // P1.2 - Unassigned, Open-Drain, Digital
- // P1.3 - Unassigned, Open-Drain, Digital
- // P1.4 - Unassigned, Open-Drain, Digital
- // P1.5 - Unassigned, Open-Drain, Digital
- // P1.6 - Unassigned, Push-Pull, Digital
- // P1.7 - Unassigned, Open-Drain, Digital
- // P2.0 - Unassigned, Open-Drain, Digital
- // P2.1 - Unassigned, Open-Drain, Digital
- // P2.2 - Unassigned, Open-Drain, Digital
- // P2.3 - Unassigned, Open-Drain, Digital
- // P2.4 - Unassigned, Open-Drain, Digital
- // P2.5 - Unassigned, Open-Drain, Digital
- // P2.6 - Unassigned, Open-Drain, Digital
- // P2.7 - Unassigned, Open-Drain, Digital
- // P3.0 - Unassigned, Open-Drain, Digital
- // P3.1 - Unassigned, Open-Drain, Digital
- // P3.2 - Unassigned, Open-Drain, Digital
- // P3.3 - Unassigned, Open-Drain, Digital
- // P3.4 - Unassigned, Open-Drain, Digital
- // P3.5 - Unassigned, Open-Drain, Digital
- // P3.6 - Unassigned, Open-Drain, Digital
- // P3.7 - Unassigned, Open-Drain, Digital
- SFRPAGE = CONFIG_PAGE;
- P1MDOUT = 0x40;
- XBR2 = 0x40;
- }
- void Interrupts_Init()
- {
- IE = 0x82;
- }
- // Initialization function for device,
- // Call Init_Device() from your main program
- void Init_Device(void)
- {
- Reset_Sources_Init();
- Timer_Init();
- Port_IO_Init();
- Interrupts_Init();
- }
- void Timer_ISR(void) interrupt 1
- {
- TF0=0;
- cnt --;
- if (cnt==0x00)
- {
- cnt =0x5;
- LED=~LED;
- }
- }
- void main(void){
- Init_Device();
- while (1){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement