' DIP_LED.bas ' author: kerwin lumpkins ' this demonstrates the basic IO of the DIP switch and the ' LEDs on portc of the DARC Board ' Portc is continually read and the output driven out to ' the LEDs ' put in the cal value for your part here (marked on the 8535 case ' most are hex 9F, some 91's and some in between Osccal = &HXX Dim Invalue As Byte Dim Outvalue As Byte Dim A As Byte 'High bits are outputs (LEDs), low bits are inputs (DIP) Config Portc = &B11110000 'set the data direction register to be safe Ddrc = &B11110000 A = 1 ' continuous loop While A = 1 'read inputs at pins of portc Invalue = Pinc And &B00001111 'set outvalue = invalue and then shift this left to the high 4 bits Outvalue = Invalue Shift Outvalue , Left , 4 'set the low 4 to be sure that the internal pullups are enabled Outvalue = Outvalue Or &B00001111 ' load the outvalue to the port Portc = Outvalue Wend End 'end program