The hdrB0 I/O pin is driven using the CCS C
compiler’s built-in output_low and output_high
functions. Support for the usb_cdc_puts function that
transmits the relay status messages originates in the
■ SCREENSHOT 6. This is the result of the USB transmission
to the CCS Serial Input/Output Monitor, which is part of the
CCS PICC C Compiler.
We are ready to compile, link, and run our Touch
Display 4. 3 when the
user control application
begins. The fill area
graphics command painted the background of the Touch
Display solid white.
Display control application. We only need to add a couple
of lines of code to the main C routine that was generated
by the Interface Designer:
//Initialize PIC Hardware,
//for an example.
As you can see in the main code snippet, the 4. 3
control application runs in a round-robin endless loop
servicing the display, touch screen, LCD backlight, and
A composite view of the blue LED image in both of its
states can be seen in Photo 2. Screenshot 6 is a capture
of the results of the usb_cdc_puts function calls.
//we added BEGIN
//we added END
gfx_SetTouchCallback(TouchTask, TRUE, TRUE);
The output of pin hdrB0 follows the state of the blue
LED displayed on the LCD. In our control application, we
depict the hdrB0 pin driving some sort of relay via a relay
driver such as the ULN2803A or NUD3105.
The Touch Display 4. 3 Design Cycle
As I worked with the Touch Display 4. 3, I found that
understanding the code that was generated by the
Interface Designer was the key to getting the most from
the Touch Display development platform.
if(usb_attached() && usb_
enumerated() && usb_cdc_connected
As you have seen, you can easily mix your specific
application code with the CCS Interface Designer-generated code to easily put the CCS Touch Display 4. 3
into your Design Cycle. NV
(hdrB0) code was added
to ensure that the hdrB0
pin matched the off
state of the window
shown on the Touch
■ PHOTO 2. Hopefully, you can easily distinguish between ON and OFF in this shot.
January 2018 59