Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /***********************************************************************************
- York University CSE3215
- Main.c
- Jan 09, 2006
- ***********************************************************************************/
- #include <hidef.h> /* common defines and macros */
- #include <mc9s12dp256.h> /* MicroController derivative information */
- #include <stdint.h>
- #pragma LINK_INFO DERIVATIVE "mc9s12dp256b"
- void main(void)
- {
- /* put your own code here */
- EnableInterrupts;
- DDRB = 0xFF; //Set PORTB as output
- DDRH = 0x00; //Set PORTH as input
- for(;;)
- {
- if(PTH < 191)
- if(PTH < 127)
- if(PTH<63)
- if(PTH_PTH0)
- PORTB = PORTB_BIT1; //set bit1(LED1)
- else
- PORTB = PORTB_BIT0; //set bit0(LED0)
- else
- if(PTH_PTH0)
- PORTB = PORTB_BIT3; //set bit3(LED3)
- else
- PORTB = PORTB_BIT2; //set bit2(LED2)
- else
- if(PTH_PTH0)
- PORTB = PORTB_BIT5; //set bit5(LED5)
- else
- PORTB = PORTB_BIT4; //set bit4(LED4)
- else
- if(PTH_PTH0)
- PORTB = PORTB_BIT7; //set bit7(LED7)
- else
- PORTB = PORTB_BIT6; //set bit6(LED6)
- /* put more of your code here */
- } /* wait forever */
- }
Advertisement
Add Comment
Please, Sign In to add comment