Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

FT800
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
twenty13

Bascom Member



Joined: 05 Jul 2011
Posts: 12

australia.gif
PostPosted: Sun Mar 29, 2015 11:01 am    Post subject: Reply with quote

Hi PeterM and Mototest,

I have received my Arduino Uno board and calibration now works fine. It looks like for the GD2 board to work properly the connections to it need to be kept as short as possible. I can now continue experimenting with the board.

Thanks for all you help.

Regards,
Back to top
View user's profile
PeterM

Bascom Member



Joined: 09 Jun 2008
Posts: 118

australia.gif
PostPosted: Sun Mar 29, 2015 11:33 am    Post subject: Reply with quote

twenty13

Thats good your up and running now!.

I have used the 180 cm jumper wires without any problems, but the biggest
issues I came across was the quality of USB cables (use a thicker cable)
and not sufficient USB power which you can use external power anyway.

_________________
Peter
Back to top
View user's profile
twenty13

Bascom Member



Joined: 05 Jul 2011
Posts: 12

australia.gif
PostPosted: Sat May 02, 2015 9:04 am    Post subject: Reply with quote

Hi Peter,

You are right. I now have a separate supply to the board and it is much much better. I now use VM800B display and it really works well.

I am also trying Xmega and so far could not succeed to save the calibration constants and start up without calibration. The calibration constant is set to 1 in the Ft800.inc file. I use the MK2 atmel programmer and studio 6. Would you be able to assist with this one? I have gone through all the routines "readtouchvariables" and "writetouchvariables" including flag "TC" and the "transmatrix()" variables and are able to print them but it looks like it doesn't save to EEPROM. I have also tried "config eeprom="mapped" " but with no change

Thanks in advanced
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5006
Location: Holland

blank.gif
PostPosted: Sat May 02, 2015 11:43 am    Post subject: Reply with quote

this topic has some info about ft800 and xmega.
so use a virtual port pin for the CS line, or alter the lib as has been shown.
if you can not get it to work, you can write to support.

_________________
Mark
Back to top
View user's profile Visit poster's website
PeterM

Bascom Member



Joined: 09 Jun 2008
Posts: 118

australia.gif
PostPosted: Sat May 02, 2015 11:47 am    Post subject: Reply with quote

twenty13

Can you please post a small demo so it can be tested?'

Mark may spot something if he gets a chance to read this post.

Edit: Oops just noticed Mark make a post just as I typed this message.

_________________
Peter
Back to top
View user's profile
twenty13

Bascom Member



Joined: 05 Jul 2011
Posts: 12

australia.gif
PostPosted: Sun May 03, 2015 6:54 am    Post subject: Reply with quote

Hi Peter and Mark,

Thanks for your replies. A reduced version of the code is attached below.

When "Lcdcal" in FT800.inc is set to "0" the display works fine except the touch points are not calibrated. The orientation bit is also set to "1". When "Lcdcal" is set to "1" then all functions up to "cmdcalibrate" executes as required but stops at "updatescreen" resulting in a blank white screen. I have the latest version of Bascom and use MK2 programmer and studio 6 to program. The program is very simple. There are 4 numbers and one button objects all incrementing. Every time when the button is touched the font size of the button should alternatively swop between 20 and 31. This same program is working fine with atmega328 including the calibration.



Code:
$regfile = "xm128a1def.dat"
$crystal = 32000000
$hwstack = 52
$swstack = 80
$framesize = 64
Config Osc = Enabled , 32mhzosc = Enabled
Config Sysclock = 32mhz

Config Vport0 = C
Ddr0 = &B0000_0011

'configure the priority
Config Priority = Static , Vector = Application , Lo = Enabled
Config Com3 = 9600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
Open "COM3:" For Binary As #1

Config Submode = New
Config Ft800 = Spid , Ftcs = Port0.6 , Ftpd = Port0.7
Config Spid = Hard , Master = Yes , Mode = 0 , Clockdiv = Clk32 , Data_order = Msb , Ss = None
Config Base = 0

$include "FT800.inc"
$include "FT800_Functions.inc"

Declare Sub Widgets
Declare Function Read_keypad() As Byte
Declare Function Istouch() As Byte


Dim My_cnt As Byte
Dim My_text As String * 5
Dim Read_tag As Byte
Dim Temp_tag As Byte                                        ' used in Read_Keys() Function
Dim Sk As Byte                                              ' used in Read_Keys() Function
Dim Read_sfk As Byte
Dim Touch_detect As Byte
Dim Tagx As Byte
Dim Opt As Byte
Dim M As Byte , N As Byte , P As Byte
Dim Read_widget As Byte
Dim Retistouch As Word
Dim Readword As Dword
Dim Tmp As Dword
Dim Flag As Byte
Key_detect Alias 0
My_text = " "
N = 31                                                      'font size
Flag = 0
M = 0
P = 0

Spiinit

If Ft800_init() = 1 Then End

   Do
   Waitms 15
   Incr M
   My_text = Str(m)
   Widgets
   Loop

End


'------------------------------------------------------------------------------------------------------------
Sub Widgets
'------------------------------------------------------------------------------------------------------------
    Clearcolorrgb 64 , 64 , 64
    Clear_b 1 , 1 , 1
    Colorrgb 255 , 255 , 255
    ' Flat effect and default Color background
    Cmdfgcolor &H0000FF
    Tagmask 1
    Tag 1
    Cmdnumber 50 , 30 , 29 , 0 , M
    Tag 2
    Cmdnumber 245 , 30 , 29 , 0 , M
    Tag 3
    Cmdnumber 50 , 150 , 29 , 0 , M
    Tag 4
    Cmdnumber 244 , 150 , 29 , 0 , M
    Tag 5
    Cmdbutton 300 , 200 , 100 , 50 , N , 0 , My_text
   Tagmask 0

   Read_widget = Read_keypad()
   If Flag.key_detect > 0 Then
      Flag.key_detect = 0

     If Read_widget = 5 Then
         P = Not P
         If P = 255 Then
            N = 31
            'P = 0
            Updatescreen
         End If
         If P = 0 Then
           N = 20
           'P = 1
           Updatescreen
         End If
     End If

   End If
 Updatescreen
End Sub                                                     ' Widget_Button
'------------------------------------------------------------------------------------------------------------
Function Read_keypad() As Byte
    Local Read_tag As Byte
    Local Ret_tag As Byte
    Read_tag = Rd8(reg_touch_tag)
    If Istouch() = 0 Then Touch_detect = 0
    If Read_tag <> 0 Then                                   ' Allow if the Key is released
       If Temp_tag <> Read_tag And Touch_detect = 0 Then
          Temp_tag = Read_tag                               ' Load the Read tag to temp variable
          Touch_detect = 1
       End If
    Else
       If Temp_tag <> 0 Then
          Flag.key_detect = 1
          Read_tag = Temp_tag
       End If
      Temp_tag = 0
    End If
    Read_keypad = Read_tag
End Function                                                ' Read_Keypad

'------------------------------------------------------------------------------------------------------------
Function Istouch() As Byte
    Local Retistouch As Word
    Retistouch = Rd16(reg_touch_raw_xy)
    Retistouch = Retistouch And &H8000
    Istouch = Retistouch
End Function
Back to top
View user's profile
twenty13

Bascom Member



Joined: 05 Jul 2011
Posts: 12

australia.gif
PostPosted: Mon May 04, 2015 2:11 pm    Post subject: Reply with quote

Hi Guys,

I think I have it sorted. For Xmega (1) Have added "EEPROM=MAPPED" and (2) made changes to Sub Waitcmdfifoempty() - blocked out ! jmp _ftWaitCmdFIFOempty and removed the block setting under to allow the rest of the code to execute.javascript:emoticon('Laughing')
Back to top
View user's profile
PeterM

Bascom Member



Joined: 09 Jun 2008
Posts: 118

australia.gif
PostPosted: Tue May 05, 2015 12:54 pm    Post subject: Reply with quote

twenty13

Sorry for the delay, I had to repair an xmega board I had lying around and just got it working.

I copied your code and just made a port change for CS and PD and it all worked regardless
of the state of LcdCal.

I don't know why you had to make those changes as mine worked first up, so I am not
sure what is going on.

Are you running the current Bascom version 2078 ?

_________________
Peter
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5006
Location: Holland

blank.gif
PostPosted: Tue May 05, 2015 1:04 pm    Post subject: Reply with quote

Since he is using the inc files from 2078, he must be using 2078.
It is simplest to write to support. There we can check version and serial and can we offer updated files so we can identify the cause.

_________________
Mark
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum