사용자 도구

사이트 도구

English

cublocapp:an36015:index

AN36015 - 터치 보정및 콘트라스트 조정

CT1820 용 터치보정및 Contrast 조정 프로그램입니다. 여러분이 만드신 프로그램에 터치보정기능을 넣고 싶으신 분들은 아래 프로그램을 카피해서 사용하세요.

#include "CT18XX"
Dim i As Integer, j As Integer    
Dim CT18_cont_value As Byte
 
Const BeepSoundLength = 60
 
Low LCD18_strobe
Low LCD18_data
Low LCD18_clock
Wait 100
 
CT18_cont_value = Eeread(&hfff,1)
If CT18_cont_value = &hff Then
    CT18_cont_value = 150
Endif
CT18contrast CT18_cont_value
 
i = Sys(16) 'os에서 touch인터럽 처리못하게함
Set I2c 66,65
Cls
Low 60
Pulsout 60,BeepSoundLength
Wait 50
 
TouchChip1byteCommand _TouchChipCmd_Disable_Touch '정지
Wait 50
_TouchRegStartAdr = TouchReadStartAdr() 'Register의 시작번지를 알아온다. 
Wait 20
 
TouchChipWriteReg &he,&h19 '&he=Calibration Set Register offset
 
TouchChip1byteCommand _TouchChipCmd_Calibrate_Mode 'calibration 로 들어감
 
'
'    첫번째 지점 (안쪽으로 15%)
'
 
Const CalX1 = 40
Const CalX2 = 280
Const CalY1 = 30
Const CalY2 = 210
Const CalLineLength = 15
 
'
'  왼쪽위
'
Line CalX1, CalY1 - CalLineLength, CalX1, CalY1 + CalLineLength
Line CalX1 - CalLineLength, CalY1, CalX1 + CalLineLength, CalY1
 
Do While (In(72)=0)
Loop  '누를때까지 대기 
TouchResponseReadout 4
Pulsout 60,BeepSoundLength
 
'
'  오른위
'
Cls
Wait 50
Line CalX2, CalY1 - CalLineLength, CalX2, CalY1 + CalLineLength
Line CalX2 - CalLineLength, CalY1, CalX2 + CalLineLength, CalY1
 
Do While (In(72)=0)
Loop  '누를때까지 대기 
TouchResponseReadout 4
Pulsout 60,BeepSoundLength
 
'
'  오른쪽아래
'
Cls
Wait 50
Line CalX2, CalY2 - CalLineLength, CalX2, CalY2 + CalLineLength
Line CalX2 - CalLineLength, CalY2, CalX2 + CalLineLength, CalY2
 
Do While (In(72)=0)
Loop  '누를때까지 대기 
TouchResponseReadout 4
Pulsout 60,BeepSoundLength
 
'
'  왼쪽아래
'
Cls
Wait 50
Line CalX1, CalY2 - CalLineLength, CalX1, CalY2 + CalLineLength
Line CalX1 - CalLineLength, CalY2, CalX1 + CalLineLength, CalY2
 
Do While (In(72)=0)
Loop  '누를때까지 대기 
TouchResponseReadout 4
Pulsout 60,BeepSoundLength
 
'
'     eeprom라이팅이 끝날때까지 대기
'
 
Do While (In(72)=0)
Loop  '누를때까지 대기 
TouchResponseReadout 4
Pulsout 60,BeepSoundLength
 
 
TouchChip1byteCommand _TouchChipCmd_Enable_Touch '시작 
Wait 50
 
Cls
Wait 50
 
Box 10,20,310,100
Box 10,140,310,230
Font 5,1
Glocate 120,50
Gprint "Contrast +"
Locate 8,7
Print "Touch Calibration Done"
Glocate 120,175
Gprint "Contrast -"
Pulsout 60,BeepSoundLength
Font 2,0
i = Sys(15) 'os에서 touch인터럽 처리하게함
On Pad Gosub TouchOccur
'
'********************* 메인 do 루프 ************************
'
Do
    Locate 24,0
    Print "Contrast : ",Dp(CT18_cont_value,3,0)
    Wait 1000
Loop
 
TouchOccur:
    If Sys(12) = 0 Then Return
    _TouchPosx = Sys(10)
    _TouchPosy = Sys(11)
 
    Pset _TouchPosx,_TouchPosy
    If _TouchPosy > 120 Then
        CT18_cont_value = CT18_cont_value - 1
        Ct18contrast CT18_cont_value
        Eewrite &hfff,CT18_cont_value,1    
    Else
        CT18_cont_value = CT18_cont_value + 1
        Ct18contrast CT18_cont_value
        Eewrite &hfff,CT18_cont_value,1    
    Endif    
    Pulsout 60,80
    Return
 
End

이전단계로

cublocapp/an36015/index.txt · 마지막으로 수정됨: 2017/10/19 22:40 저자 Comfile Technology