BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 12:18 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSEROUT
PostPosted: Sun Dec 05, 2010 2:29 pm 
Offline
Guru

Joined: Sun Jan 03, 2010 8:01 am
Posts: 55
Location: Eau Claire, WI
Hey Guys,

I'm working on one of the final steps of my project which is centered around a Nano-40 and I've hit a really hard and tall wall. I am working with an LCD that uses a serial input from a company called 4D Systems (http://www.4dsystems.com.au/prod.php?id=113).

I am able to communicate with the display without any issues (which means that I can establish communication and send commands for text and buttons without any issues, any commands sent require an acknowledgement which $06) but I am unable to read the current position of the touch screen. I have had several posts with the Forum Moderator for this product at 4D Systems but oddly enough there are a number of limited Stamp users who frequent the 4D Systems forum let alone any posts regarding how to interface the Touch Screen part of the LCD....this lack of content on this subject makes me believe that one of the two are true:

1) That this process is easy and no one has encountered any issues
2) I am breaking new ground

So...here is my problem (plus I've added a few comments):

When I ask the touch screen register to report "what is going on" the display will response with a 0 which indicates no activity in which case you keep reading the touch screen register until some type of touch screen activity is registered. This issue is that after anywhere from 1 to 5 reads of the touch screen register the HSERIN command will execute my timeout code. Is there anything else I can add to the HSERIN (or HSEROUT) command that may help with troubleshooting serial comm issues. I will also admit that it is very hard to interface devices to a stamp when you are not an expert in how all of the commands work the the Atoms!

Here is the code example (if nothing else people will see how to use the LCD display from 4D Sytems). 4D Systems tech support stated that the reads for a touch should take less than 50mS.

Thanks in advance for anyone that can give me some advice on what to do next!

RST CON 2

X VAR WORD
Y VAR WORD

TSTATUS VAR WORD
XLSB VAR BYTE
XMSB VAR BYTE
YLSB VAR BYTE
YMSB VAR BYTE

CLEAR

DEBUG [0]
LCDSTAT VAR WORD
LOW RST 'This is the reset routine for the LCD display
PAUSE 500
HIGH RST
PAUSE 1000

DEBUG ["Sending Auto-Baud Command",13] 'This command must be sent within 1 to 5 seconds of the LCD being turned on or reset
SETHSERIAL1 H9600
HSEROUT [$55]
GOSUB NAK

DEBUG ["Turn on touch screen",13] 'This is a key command because by default the touch screen is turned off!
HSEROUT [$59,$05,$00]
GOSUB NAK

DEBUG ["Reset touch screen",13]
HSEROUT [$59,$05,$02]
GOSUB NAK

DEBUG ["Detecting touch...",13]

TOUCH
X=X+1
PAUSE 750
HSEROUT [$6F,$04] 'This gets the value of the touch screen register
PAUSE 200 'Have not used this command and have also varied the time...no difference in the end result
RETRY
HSERIN TY,100,[TSTATUS] ' I have verified with tech support that this is a single byte status returned
DEBUG [DEC X," TSTATUS is:",HEX TSTATUS,13]

IF TSTATUS=$00 THEN
DEBUG ["No Touch!",13]
HSEROUT [$6F,$00]
DEBUG ["Reading Touch cords",13]
'HSERIN TY,100,[XMSB,XLSB,YMSB,YLSB] 'The results are the same if I do or don't use this command
'GOSUB NAK
DEBUG ["Cords are:",DEC XMSB,DEC XLSB,DEC YMSB, DEC YLSB,13]
ENDIF

IF TSTATUS=$01 THEN
DEBUG ["Touch Press!",13]
HSEROUT [$6F,$01]
HSERIN TY,100,[XMSB,XLSB,YMSB,YLSB]
DEBUG ["Cords are:",DEC XMSB,DEC XLSB,DEC YMSB, DEC YLSB,13]
ENDIF

IF TSTATUS=$02 THEN
DEBUG ["Touch release!",13]
HSEROUT [$6F,$02]
HSERIN TY,100,[XMSB,XLSB,YMSB,YLSB]
DEBUG ["Cords are:",DEC XMSB,DEC XLSB,DEC YMSB, DEC YLSB,13]
ENDIF

IF TSTATUS=$03 THEN
DEBUG ["Touch moving!",13]
HSEROUT [$6F,$03]
HSERIN TY,100,[XMSB,XLSB,YMSB,YLSB]
DEBUG ["Cords are:",DEC XMSB,DEC XLSB,DEC YMSB, DEC YLSB,13]
ENDIF

GOTO TOUCH

END

NAK
HSERIN [LCDSTAT]
IF LCDSTAT=$15 THEN
DEBUG ["Command Error:",HEX LCDSTAT,13]
ENDIF

IF LCDSTAT=$06 THEN
DEBUG ["Command OK:",HEX LCDSTAT,13]
ELSE
DEBUG ["Command returned: ",HEX LCDSTAT,13]
ENDIF

RETURN

TY
DEBUG ["!!!!! RX PROBLEM !!!!!",13]
GOTO RETRY


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Sun Dec 05, 2010 7:22 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Jeezus! This thing is damn near a laptop on a module! :o

Have you shown your code to the forum moderator?
I took a quick look at the web site. The downloads tab shows a boatload of software designed to set many-many-many configurations in the unit's controller. Have you tried checking the settings in the controller to see if the factory glitched something? Failing that, you might as well call their support and check these settings with them while powered up or get an RMA number and send it back for troubleshooting.
Good luck with this one.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Mon Dec 06, 2010 1:19 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
One suggestion I'd make is to try more than once on the commands. Right now if it times out you give up. Instead, have it try the same command again one or more times and then give up.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Mon Dec 06, 2010 6:10 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 9:06 am
Posts: 120
Location: Wisconsin USA
I think i see a couple possible problems.

HSERIN TY,100,[TSTATUS]

I haven't used a time out in quite some time, but last time i used the timeout in hserial, it was using 0.5us
IE 200000 = 1000ms
so 100 would only be 50us or 50 microseconds.

If this is still the case, as i read it was being switched back to ms, but i never followed up on checking, your timeout might be to short.

Just wing it, and try removing the timeout label and timer altogether
HSERIN [TSTATUS]

This way it will wait until it at least receives something.
If it fails to pick anything up then you'll know the problem might be with your touchscreen.
Also remove the pause 200 after the hserout,, if you still need a pause try 5ms
pause 200 is a whole 200ms, which might be a little longer than it sounds.

I like this idea, i wouldn't mind using a touch screen, but i'd need one with a 65mm by 16mm usable area for my 16x2 LCD.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Tue Dec 07, 2010 8:46 am 
Offline
Guru

Joined: Sun Jan 03, 2010 8:01 am
Posts: 55
Location: Eau Claire, WI
Thanks for the responses guys! This LCD display has a lot going for it...plus the price tag...less than $80!

The Forum Moderator as 4D Systems suggested I d/l and install their FAT software which is used to test the plethora of options that this LCD offers (in the process I discovered that the speaker isn't working which I do need too). I was able to use the FAT software to test the touch screen functions but it took me several attempts to actually get some type of activity from the touch screen; to me the touch screen still seems to operate in a erratic manner to me but once again this is my first time using a touch device.

I have tried to use the HERSIN with and without the timeout options; the results are the same but Fallentine thanks the the insight on the delay; I thought my delay was set for a 100ms (4D Forum Moderator wanted me to add a delay of at least 50ms as many of the touch screen coversions took less than 25ms to complete). So I'll give this a try tonight if a get time (add a much larger timeout value). Again some of my issues may be my lack of experience and good understanding of how the serial commands work with the Atoms.

WHEN :mrgreen: I get this LCD Display to work I'll be sure to post a tutorial on this LCD device; I can see MANY applications just in my home (watch out irrigation system...you are getting upgraded); I'm sure that others may have a use for this display too!

Thanks for the comments guys!


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Tue Dec 07, 2010 10:45 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Fallentine is correct. The hserin timeout is in .5us increments. Most timeouts are in very small increments so you can have very short timeouts. So use 200000 for a 100ms delay. However if you aren't getting anything back when not using timeouts then something else is wrong.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Tue Dec 07, 2010 12:46 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
The manual states timeout is in milliseconds. Is this going to be changed to milliseconds or left in half usecond increments?

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Tue Dec 07, 2010 2:09 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Herin and Serin timeouts will remain the way they are. So the manual will be updated. Is this in the beta manual that it says its in milliseconds?

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Tue Dec 07, 2010 3:04 pm 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Acidtech wrote:
Herin and Serin timeouts will remain the way they are. So the manual will be updated. Is this in the beta manual that it says its in milliseconds?

Yep, the latest beta one has this as milliseconds...

Kurt

P.S. - Would be great if the next IDE had the updated manual.


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Tue Dec 07, 2010 5:16 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Mea Culpa. I got handed the job of "cleaning up" the latest manual in Downloads (which says milliseconds) weeks ago. Between Thanksgiving, my mother's near death, job searching, dealing with VA clinics all over the bay area for a future kidney stone operation, and the world's cra**iest PDF editor, it is largely undone. Actually, it was largely done, but then I discovered it was unusable to Dale for fixing the original document. So, no manual in the IDE just yet.
I have finally found a great (FREE!) PDF editor that works like MS Word, with automated proofing features, and marks the pages that received corrections, making it all sooo much easier. And when proofing is done, I have to check the code. And there is now a list of corrections which only Dale may be able to deal with. So think two weeks down the road for a polished product.
If you're interested, this PDF editor can be inspected and downloaded for trial at:
http://www.iceni.com/infix.htm
Patience, you will be pleased with the final result.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Wed Dec 08, 2010 6:49 am 
Offline
Guru

Joined: Sun Jan 03, 2010 8:01 am
Posts: 55
Location: Eau Claire, WI
Heys guys...got another two newbie questions for you....

1) If a serial device is going to send four bytes of information would it make a difference in the process that I would use to receive the data; see my two examples below

HSERIN [xmsb, xlsb, ymsb, ylsb]

vs.

HSERIN [xmsb]
HSERIN [xlsb]
HSERIN [ymsb]
HSERIN [ylsb]

2) Is it OK to pre-set the logic level of the HSERIN pin to a hi or low using the HI LOW command?

Kenjj: sounds like you have had one heck of a week! It has not been a good week for me as well; everything in the house broke last weekend (including my Jeep) and not it is Finals Week for me so I've got a ton of grading to do in the next week! Hope that your mom and everything else goes well. I will assume that you are a vet to also...thanks for your service to your country!


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Wed Dec 08, 2010 7:28 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Hi Brian,

1) No difference, other than having the code here be slightly larger and slower with separate HSERINS. If this was SERIN vs HSERIN, I would say that there is the possibility that the time it takes to get out of the a serin command and into the next one, that you could potentially be too slow and miss the start bit of the next byte...

2) Not sure why you would want to do this? On a BAP, I would think this would screw things up, as multiple H8 IO pins are connected up to the BAP pin and this would force one of them to be high or low... But not sure what this would do on Nano...

I hope both of you have a better week.

Kurt


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Wed Dec 08, 2010 11:12 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Kurt, the latest Studio has the latest beta Syntax manual in it(2.0.0.6).

Also kur is correct. The seperate hserins won't have much of any effect other than making your code a little larger. Seperate Serin commands would add delays between being able to receive commands.

Also do not preset the Hserin pin. These pins are handled automatically by the hserial backend.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Wed Dec 08, 2010 3:12 pm 
Offline
Guru

Joined: Sun Jan 03, 2010 8:01 am
Posts: 55
Location: Eau Claire, WI
Hey Guys,

Well...I think the 4D guys have written me off so I think I'm on my own now (with you guys for support)! :D

I hate to ask this question but seeming the touch screen seems to work with "their software" is it possible that I am running into some type of glitch with the HSERIN command with the Nano? I have already swapped Nano-40s without any luck..I do have a Atom Pro-28 still in the anti-static bag...should I give that a try (I am not under any cost constraints as this is a home project and NOT a mass produced item).

Let me explain my reason for thinking there may be a HSERIN glitch I'm referring to...

When I read the touch status register four bytes are returned from the LCD...I am able to read the first three bytes but for some %$W%$% reason when I read the fourth byte a timeout is generated and I am not able to read that fourth byte...but of course when I go to read the touch status register of course it locks up and my code stops.

Is there a way that I can use the HSERIN to see what bits are coming in (its times like this I wish I had the $$$ for digital storage scope) from the LCD or maybe some features of the IDE that I am missing.

Thanks in advanced for any comments!

Later-Brian


Top
 Profile  
 
 Post subject: Re: Issues with 4D Systems Touch Screen or ATOM HSERIN/HSERO
PostPosted: Wed Dec 08, 2010 4:58 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Have you tried running this against a PC serial port?
Consider sending your GLCD module back to 4D with an RMA and let them confirm the unit is functioning properly before racking your brains any more.
BTW, you may have never seen any reported problems on the forums because they may be eliminating them after a time. Some people just CAN'T stand blemishes of any kind! Try posting something in the Parallax forums about this. If Stamp users have posted about this unit on 4D's forums, then someone at Parallax may have your solution.
Good luck with your project.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO