source: fact/tools/hvMCUtest/fakePLD/macros.h@ 20063

Last change on this file since 20063 was 12142, checked in by neise, 13 years ago
Arduino code for fake PLD arduino
File size: 660 bytes
Line 
1
2#define SETBIT(PORT,PIN) (PORT |= 1<<PIN)
3#define CLRBIT(PORT,PIN) (PORT &= ~(1<<PIN))
4
5#define ISRXFHIGH ( PINC & (1<<RXF) )
6#define ISRXFLOW ( !ISRXFHIGH)
7#define ISTXEHIGH ( PINC & (1<<TXE) )
8#define ISTXELOW ( !ISTXEHIGH)
9#define READFROMDATABUS ( ( (PINB & 0x03) << 6 ) | ( (PIND & 0xfc) >> 2) )
10#define ISBUTTONPRESSED (!((PINC & (1<<BUTTON))>>BUTTON))
11
12#define MAKEDATABUSINPUT {DDRB &= ~((1 << 0) | (1<<1)); DDRD &= ~0xfc; PORTB |= (1 << 0) | (1<<1); PORTD |= 0xfc; }
13#define MAKEDATABUSOUTPUT { DDRB |= (1 << 0) | (1<<1); DDRD |= 0xfc; }
14
15#define PUTONDATABUS(x) {PORTB = (PORTB & 0xfc) | (x&0xc0)>>6 ; PORTD = (PORTD & 0x03) | (x&0x3f)<<2; }
Note: See TracBrowser for help on using the repository browser.