Purebasic 4.20
This includes the configuration settings on this page, Analog Outputs, Digital I/O and Timers & Counters. To configure the U3 power-up default settings, first configure your I/O to the power-up default settings you want. However, using low-level functionality you can. False if U3-LV or hardware version <1.30.įollowing is example pseudocode to write and read the local ID:ĮPut (lngHandle, LJ_ioPUT_CONFIG, LJ_chLOCALID, 4, 0) ĮGet (lngHandle, LJ_ioGET_CONFIG, LJ_chLOCALID, &dblValue, 0) Ĭurrently there is no IOType for configuring all the power-up default settings. The following constants are then used in the channel parameter of the config function call to specify what is being written or read: There are two IOTypes used to write or read general U3 configuration parameters: A simpler option is using the following IOType created exactly for this purpose, which does the same thing as the 8 function calls above:ĮPut (lngHandle, LJ_ioPIN_CONFIGURATION_RESET, 0, 0, 0) This disables all timers and counters, sets the timer/counter pin offset to 4, sets the timer clock base to 48 MHz (no divisor), sets the timer clock divisor to 0, and sets all flexible I/O to digital. One way to do this is with the following pseudocode:ĮPut (lngHandle, LJ_ioPUT_CONFIG, LJ_chNUMBER_TIMERS_ENABLED, 0, 0) ĮPut (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_COUNTER_PIN_OFFSET, 4, 0) ĮPut (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_BASE, LJ_tc48MHZ, 0) ĮPut (lngHandle, LJ_ioPUT_CONFIG, LJ_chTIMER_CLOCK_DIVISOR, 0, 0) ĮPut (lngHandle, LJ_ioPUT_COUNTER_ENABLE, 0, 0, 0) ĮPut (lngHandle, LJ_ioPUT_COUNTER_ENABLE, 1, 0, 0) ĮPut (lngHandle, LJ_ioPUT_DAC_ENABLE, 1, 0, 0) //Ignored on hardware rev 1.30+.ĮPut (lngHandle, LJ_ioPUT_ANALOG_ENABLE_PORT, 0, 0, 16)
Purebasic 4.20 software#
a value of b00111 (=d7), and 5 bits will be updated.ĮPut (lngHandle, LJ_ioPUT_ANALOG_ENABLE_PORT, 2, 7, 5) īecause of the pin configuration interaction between digital I/O, analog inputs, and timers/counters, many software applications will need to initialize the flexible I/O to a known pin configuration. Configure FIO2-FIO4 as analog, and FIO5-FIO6 as digital, without Configure FIO0-FIO2 and EIO0-EIO7 as analog, all others as digital. Following are some pseudocode examples:ĮPut (lngHandle, LJ_ioPUT_ANALOG_ENABLE_BIT, 3, 1, 0) ĮPut (lngHandle, LJ_ioPUT_ANALOG_ENABLE_BIT, 3, 0, 0) When a request is done with one of the port IOTypes, the Channel parameter is used to specify the starting bit number, and the x1 parameter is used to specify the number of applicable bits. LJ_ioGET_ANALOG_ENABLE_PORT //x1 is number of bits. LJ_ioPUT_ANALOG_ENABLE_PORT //x1 is number of bits. The following 4 IOTypes are used for that: One of the most important operations on the U3 is configuring the flexible I/O as digital or analog.