15. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
5 › { Algorithm for ADC }
Step1: Start
Step2: Load ADCON0 with 80H and ADCON1 with 81H for
selecting RA0(89H for selecting RA1) as analog input port
Step 3: Set A/D conversion status bit, ADGO =1 to start
conversion.
Step 4: Check if ADGO=0( i.e. A/D Conversion complete), if yes
transfer higher 2 bits in ADRESH to a variable and shift it to left 8
times, then OR the contents with lower 8 bits in ADRESL. If no,
go to step 4.
Step 5: Compare the digital value with a threshold, and transmit
it via UART.
Step 6: Stop
The same procedure is done for the data input at analog
channel RA1.
16. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
5 › { Algorithm for asynchronous transmission }
Step 1: Start
Step 2: Configure PORT C as output port
Step 3: Select asynchronous transmission by clearing SYNC bit.
Step 4: Set the transmit enable bit (TXEN) to enable data
transmission
Step 5: Set BRG bit for high baud rate selection
Step 6: Initialize SPBRG= 128 for the baud rate 115200 using the
equation
Baud rate= fosc/(16*(x+1))
Step 7: Enable serial port by setting Serial port enable bit, SPEN
Step 8: Move the character to be sent to the transmit register, TXREG
Step 9: Check if transmit shift register status bit, TRMT =1. If yes,
transmission completed. If no, go to step 9
Step 10: Stop
17. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
5 › { Algorithm for Gloves }
Step1:Do the basic Initialization –ADC,USART(115200 bps), PULL
UP keys etc
Step2:Take ADC readings through channel 0 and 1 continuously
when PULL UP key(RB2) is pressed
Step3: If channel0 (X - axis) value is less than current ADC value
send 'L' to USART. If greater then send 'R'
Step4:If channel1 (Y - axis) value is less than current ADC value,
send 'D' to USART. If greater then send 'U' to USART
Step5:If PULL UP key RB1 is pressed send '#' to USART(for right
click command)
Step6:If interrupt key RB0 is pressed once send '$' to USART(for
single click command)
And if RB0 is pressed twice send “$ $” to USART(for double click
command)
Step7:Goto step 2
18. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
5 › { Algorithm for configuring Bluetooth module }
Step1:Configure USART to 115200bps
Step2:Transmit '+''+''+'
Step3:transmit "AT" followed by <CR> and check whether
"OK" is received
Step4:transmit AT+BTLNM=”HID-BLUETOOTH” followed by
<CR> wait for "ok"
Step5:Transmit AT+BTURT=<Baud>, <Data Bits>, <Parity>,
<Stop Bits>, <Flow Control> followed by <CR>
eg : AT+BTURT=115200,8,0,1,0
Step6:Transmit AT+BTSRV=1 followed by <CR>
19. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
5 › { Algorithm for Mouse Action }
Step 1: Start
Step 2: Declare library functions (from API Viewer and MSDN) for
configuring mouse actions
Step 3: Set the properties of MS Comm1 and MSComm2
Step 4: Create a form such that when the port is open display
COM1-COM8 for COMM PORT selection
Step 5: Get the current cursor position and compare the data in
inbuff with L, R, U, D and set the cursor point to that direction by 2
pixels. If the data is $, # or * perform left click, right click or double
click. Continue checking the data received at COMM port.
Step 6: Stop
20. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
6 Initialize ADC
Initialize USART & set baud rate =
115200
Set I/P ports RA0 (L & R) And RA1 (U
& D)
Set RC6 as O/P port
Store 10 bit ADC O/P of RA0 in
integer X & RA1 in integer Y
If
Y > 550
Transmit ‘U’
Transmit ‘R’
If
Y< 450
If
X <400
Transmit ‘D’ Transmit ‘L’
If
X> 600
Yes
Yes
Yes
No No
Start
Yes
21. Introduction
Block Diagram
Functional Blocks
Circuit Diagram
Algorithm
Flowchart
Pros & Cons
Future Expansion
References
PROS
› prevent carpal tunnel
syndrome and other
repetitive stress injuries
› Video game controller
› Perfect for giving
presentations
› Intuitive
CONS
› cumbersome
› Movement is not that
smooth
› Need to wear gloves
7