Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <targets/AT91SAM7.h>
- #define LCD_BCK (1<<20)
- #define BCK_ON PIOB_ODSR |= LCD_BCK;
- #define BCK_OFF PIOB_ODSR &= ~LCD_BCK;
- #define BCK_NEG_STATE PIOB_ODSR ^= LCD_BCK;
- void init(void){
- PMC_PCER |= PMC_PCER_PIOB | PMC_PCER_TC0;// enable PIOB TIM0
- PIOB_PER |= LCD_BCK; // pin enable
- PIOB_OER |= LCD_BCK; // as output
- PIOB_OWER|= LCD_BCK; // force set
- TC0_CCR = TC0_CCR_CLKDIS;// disable timer0
- TC0_CMR=(1<<2); // pescaler 1024
- (void)TC0_SR; // reset ovf flag
- TC0_IDR = 0xFF; // disable interrupths
- TC0_CCR = TC0_CCR_CLKEN|TC0_CCR_SWTRG; // start and reset timer
- }
- int main(void){
- init();
- while(1){
- if(TC0_SR&TC0_SR_COVFS)BCK_NEG_STATE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement