Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:36 20 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Continuation from cog31s GPS issue.

     Page 3 of 3    
Author Message
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 425
Posted: 05:17pm 13 Oct 2019
Copy link to clipboard 
Print this post

I have just found a strange phenomenon. In my task called every 10 ms, I print the time between two calls when it exceeds 11ms.
the code is the following

  if ptime2> 11 then
    print "time between 2 tick of 10ms:"; str $ ((ptime2) / 1000,4,3)
  end if

it give that


Run
time between 2 tick of 10ms:   0.013
error i1=0  nbcar:15
time between 2 tick of 10ms:   0.012
error i1=0  nbcar:25
time between 2 tick of 10ms:   0.012
time between 2 tick of 10ms:   0.014
time between 2 tick of 10ms:   0.012
error i1=0  nbcar:16
time between 2 tick of 10ms:   0.012
error i1=0  nbcar:82
>




In addition I also print a messgae if the iterruption on the UART is done while there are no characters "if loc (#n) = 0"
in which case I get this

if in my timeout message (in the task called all s10ms), I add some spaces, I no longer get error "loc (#n) = 0"
the code is as follows:

if ptime2> 11 then
    print "   time between 2 tick of 10ms:"; str $ ((ptime2) / 1000,4,3)
  end if

it give that

Run
  time between 2 tick of 10ms: 323.989
  time between 2 tick of 10ms:   0.012
  time between 2 tick of 10ms:   0.012
  time between 2 tick of 10ms:   0.012
  time between 2 tick of 10ms:   0.012
  time between 2 tick of 10ms:   0.012
  time between 2 tick of 10ms:   0.012
  time between 2 tick of 10ms:   0.012
>

Edited 2019-10-14 03:17 by goc30
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3649
Posted: 07:20pm 13 Oct 2019
Copy link to clipboard 
Print this post

  goc30 said  
  JohnS said  

I think that error means something is wrong.

Are you perhaps, due to going around your FOR loop, removing an extra character which has flagged an interrupt?  I suspect so, i.e. by having the loop you then cause the error.

John


uart interrupt is send when one (minimum) char is in buffer. if I receive interrupt and "loc(#n)" say there is no char, this is wrong!!

where is FOR loop ??


You used to have a FOR loop.  Instead, you now remove as many chars as Loc(#2) says, but it comes to the same thing.

Are you getting an interrupt per char and expected to remove one char only?  Perhaps.  If so, when you remove more than one char you will in due course get interrupt(s) with no chars - it certainly fits what you see and I don't see any alternative suggested by anyone.

If it were me I'd read the mmbasic internal C code to see what it does exactly.

John
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024