Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Timing differences from zx328n to zx40n ?

 
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode
Author Message
FFMan



Joined: 09 Jan 2010
Posts: 223

Posted: 25 March 2010, 21:50 PM    Post subject: Timing differences from zx328n to zx40n ? Reply with quote

Don,

I've moved some code that runs quite happily on a 328n, 328l and zx24a to a zx40n and I am seeing intermittant problems with text positioning on the lcd display.

every few seconds or so an item of text will be missing a letter or incorrectly positioned.

I am driving the lcd in 8 bit mode using:-

port c for d0-d7 on the lcd
d7 =ena
d5=r/s
d6=r/w

it is of course possible there is a wiring issue but i did test the lcd display on the 328 last night and it seemed ok

are there any differences that might be causing an issue, or should i look for a more basic problem ?

thanks
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 25 March 2010, 21:57 PM    Post subject: Re: Timing differences from zx328n to zx40n ? Reply with quote

FFMan wrote:
are there any differences that might be causing an issue, or should i look for a more basic problem ?
The execution speed of a ZX-328n and ZX-40n should be nearly the same so I wouldn't suspect a timing issue.

If you would post the code for the send-a-byte-to-the-LCD routine for the ZX-328n and ZX-40n along with the pertinent definitions perhaps someone could spot an issue.
Back to top
FFMan



Joined: 09 Jan 2010
Posts: 223

Posted: 25 March 2010, 22:36 PM    Post subject: Reply with quote

the code comes direct from one of the examples off your site. The only mod was to use a table to locate the pin as on the 328 i couldn't use a complete port and aliasing that was originally done.

I see there is a comment in the borrow code regards additional delays, I shall have a play with a small delay as indicated and see if it helps.

If anyone has made this transition and found the solution that would be good.

The code for 328 and zx40 is the same code:-
Code:
Private Sub LCD_Out (byval C as Byte)
    'debug.print "Pins"
   dim i as byte
   locktask
   
   ' send a single byte to the LCD in text mode
     call PutPin (LCD_Enable, zxOutputLow)   ' set enable low
   for i=0 to 7
      call PutPin(LCD_Pin(i),GetBit(C,i))
   next i
   
   ' Debug.Print chr(C)
    call PutPin (LCD_RS, zxOutputHigh)      ' RS  = Data
   call PutPin (LCD_RW, zxOutputLow)      ' R/W = write mode

   call PutPin(LCD_Enable,zxOutputHigh)
   call delay (0.002)
   call PutPin(LCD_Enable,zxOutputLow)
   
   'call PulseOut (LCD_Enable, 2, 1)      ' E = enable 2 micro-seconds  long
   ' note: per docs 37 micro seconds are required for a write operation.
   ' testing reveals no additional delay is needed for the target device.
    'call delay (0.001)                  ' delay 2/1000 seconds

   unlocktask
   
End Sub
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 26 March 2010, 0:50 AM    Post subject: Reply with quote

FFMan wrote:
I shall have a play with a small delay as indicated and see if it helps.
You should note that the Delay() call defeats the purpose of the LockTask() in that it forces the task to be unlocked. The subroutine Pause() does not have that side effect nor does the PulseOut() call that was used in the original code.
Back to top
FFMan



Joined: 09 Jan 2010
Posts: 223

Posted: 26 March 2010, 22:11 PM    Post subject: Reply with quote

as usual don, right on the money - changed the delay statements to pause and all came good. interaction with another task must have been causing intermittant timing issues. Not sure why this was only apparent on the zx40 and not on the 328 but there is an answer somewhere i'm sure.

all fixed now and running quicker as once the timing was fully under control i was able to tighten the timing a bit.

thanks
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 26 March 2010, 23:16 PM    Post subject: Reply with quote

FFMan wrote:
interaction with another task must have been causing intermittant timing issues.
It is difficult to guess what the issue might be. I checked several datasheets for HD44780 devices - they all indicated a minimum E pulse width of 450nS and no maximum pulse width.

By the way, the pulse generated by PutPin() in zxOutputPulse mode should meet the minimum E pulse width; it should be about 540nS wide (8 CPU cycles).
Code:
Call PutPin(LCD_Enable, zxOutputPulse)

Also, you may have noticed that I edited your post, adding "code" tags around the source code. This makes it much easier to read. When you post, you can select a block of text and click on the Code button located above the message edit box. Doing so adds the words "code" and "/code" enclosed in square brackets. You can type them in directly, too.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group