-- ----------------------------------------------------------------------------- -- > 4 end function procedure port_A_low_direction'put( byte in x ) is TRISA = ( TRISA & 0xF0 ) | ( x & 0x0F ) end procedure function port_A_low_direction'get return byte is return TRISA & 0x0F end function var volatile byte port_B_direction at TRISB var volatile bit pin_B0_direction at TRISB : 0 var volatile bit pin_B1_direction at TRISB : 1 var volatile bit pin_B2_direction at TRISB : 2 var volatile bit pin_B3_direction at TRISB : 3 var volatile bit pin_B4_direction at TRISB : 4 var volatile bit pin_B5_direction at TRISB : 5 var volatile bit pin_B6_direction at TRISB : 6 var volatile bit pin_B7_direction at TRISB : 7 procedure port_B_high_direction'put( byte in x ) is TRISB = ( TRISB & 0x0F ) | (( x & 0x0F ) << 4) end procedure function port_B_high_direction'get return byte is return TRISB >> 4 end function procedure port_B_low_direction'put( byte in x ) is TRISB = ( TRISB & 0xF0 ) | ( x & 0x0F ) end procedure function port_B_low_direction'get return byte is return TRISB & 0x0F end function -- port and pin value var byte _port_A_shadow var byte _port_B_shadow procedure _port_A_flush is portA = _port_A_shadow end procedure procedure _port_B_flush is portB = _port_B_shadow end procedure procedure pin_A0'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 0 MyBit = x portA = _port_A_shadow end procedure procedure pin_A1'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 1 MyBit = x portA = _port_A_shadow end procedure procedure pin_A2'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 2 MyBit = x portA = _port_A_shadow end procedure procedure pin_A3'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 3 MyBit = x portA = _port_A_shadow end procedure procedure pin_A4'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 4 MyBit = x portA = _port_A_shadow end procedure procedure pin_A5'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 5 MyBit = x portA = _port_A_shadow end procedure procedure pin_A6'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 6 MyBit = x portA = _port_A_shadow end procedure procedure pin_A7'put( bit in x ) is pragma inline var bit MyBit at _port_A_shadow : 7 MyBit = x portA = _port_A_shadow end procedure procedure pin_B0'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 0 MyBit = x portB = _port_B_shadow end procedure procedure pin_B1'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 1 MyBit = x portB = _port_B_shadow end procedure procedure pin_B2'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 2 MyBit = x portB = _port_B_shadow end procedure procedure pin_B3'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 3 MyBit = x portB = _port_B_shadow end procedure procedure pin_B4'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 4 MyBit = x portB = _port_B_shadow end procedure procedure pin_B5'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 5 MyBit = x portB = _port_B_shadow end procedure procedure pin_B6'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 6 MyBit = x portB = _port_B_shadow end procedure procedure pin_B7'put( bit in x ) is pragma inline var bit MyBit at _port_B_shadow : 7 MyBit = x portB = _port_B_shadow end procedure procedure portA'put( byte in x at _port_A_shadow) is _port_A_flush end procedure procedure portB'put( byte in x at _port_B_shadow) is _port_B_flush end procedure var byte port_A_low procedure port_A_low'put( byte in x ) is _port_A_shadow = ( _port_A_shadow & 0xF0 ) | ( x & 0x0F ) _port_A_flush end procedure function port_A_low'get return byte is return portA & 0x0F end function var byte port_A_high procedure port_A_high'put( byte in x ) is _port_A_shadow = ( _port_A_shadow & 0x0F ) | ( x << 4 ) _port_A_flush end procedure function port_A_high'get return byte is return portA >> 4 end function var byte port_B_low procedure port_B_low'put( byte in x ) is _port_B_shadow = ( _port_B_shadow & 0xF0 ) | ( x & 0x0F ) _port_B_flush end procedure function port_B_low'get return byte is return portB & 0x0F end function var byte port_B_high procedure port_B_high'put( byte in x ) is _port_B_shadow = ( _port_B_shadow & 0x0F ) | ( x << 4 ) _port_B_flush end procedure function port_B_high'get return byte is return portB >> 4 end function -- ------------------------------------------------------------------ -- Fuses -- ------------------------------------------------------------------ pragma fuse_def OSC 0x0013 { XT = 0x0001 RC_NOCLKOUT = 0x0012 RC_CLKOUT = 0x0013 LP = 0x0000 INTRC_NOCLKOUT = 0x0010 INTRC_CLKOUT = 0x0011 INTOSC_NOCLKOUT = 0x0010 INTOSC_CLKOUT = 0x0011 HS = 0x0002 EXTCLK = 0x0003 ER_NOCLKOUT = 0x0012 ER_CLKOUT = 0x0013 } pragma fuse_def WDT 0x0004 { ON = 0x0004 OFF = 0x0000 } pragma fuse_def WatchDog 0x0004 { ON = 0x0004 OFF = 0x0000 } pragma fuse_def PWRTE 0x0008 { ON = 0x0000 OFF = 0x0008 } pragma fuse_def PowerUp 0x0008 { ON = 0x0000 OFF = 0x0008 } pragma fuse_def MCLRE 0x0020 { ON = 0x0020 OFF = 0x0000 } pragma fuse_def LVP 0x0080 { ON = 0x0080 OFF = 0x0000 } pragma fuse_def DATA 0x0100 { CP_ON = 0x0000 CP_OFF = 0x0100 } pragma fuse_def CP 0x2000 { ON = 0x0000 OFF = 0x2000 } pragma fuse_def Protection 0x2000 { ON = 0x0000 OFF = 0x2000 } pragma fuse_def BOREN 0x0040 { ON = 0x0040 OFF = 0x0000 } pragma fuse_def BODEN 0x0040 { ON = 0x0040 OFF = 0x0000 } pragma fuse_def BOR 0x0040 { ON = 0x0040 OFF = 0x0000 } -- ------------------------------------------------------------------ -- LKR file -- ------------------------------------------------------------------ -- Interpretating LKR-file -- LKR FILE NOT FOUND !!!!