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 = 0x10;
- // Peripheral specific initialization functions,
- // Called from the Init_Device() function
- void Reset_Sources_Init()
- {
- WDTCN = 0xDE;
- WDTCN = 0xAD;
- }
- void Timer_Init()
- {
- SFRPAGE = TIMER01_PAGE;
- TMOD = 0x01;
- }
- void Port_IO_Init()
- {
- 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();
- Port_IO_Init();
- Interrupts_Init();
- Timer_Init();
- }
- Timer_ISR(void) interrupt 1{
- TF0 = 0;
- }
- void main(void){
- Init_Device();
- TR0 = 1;
- while (1){
- PCON |= 0x1;
- cnt--;
- if (cnt == 0){
- LED=~LED;
- cnt = 0x10;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement