BasicMicro - Forums

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

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Wrong Numbers…I don’t see why
PostPosted: Sat Oct 16, 2010 6:26 am 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi
I would like to understand why I read wrong numbers…….
A Phone is connected to the DTMF receiver 8870,
Q1-Q4 is connected to P0-P3 and I read the Numbers. So far it works fine,
and I can se the right numbers on the terminal.
I use:
Numbers var byte
But when I play for a while with the phone-buttons, after a while I read wrong numbers,
like: 240 but should be 2
I connected 4 LED to the Outputs Q1-Q4 to see the binary number,
and the binary numbers are always right.
…only 4 bit…. where the wrong numbers come from…
….. OK I solved it, but don’t understand it……
I changed:
“Numbers var byte” in “ Numbers var nib” and it is O.K
I believe:
the not used 00’s in the memory stay as 000‘s…???

If someone has time, and patience with so, may have a look at my code, I added partly.
I can not find the reason for the wrong Numbers, but would be interested to understand.
Heinz

Code:
StDPin        con        p11            'on Pin 15 of MT8870 =high if DTMF-Ton presant
x                var        byte
Number        var        nib
Zahlen          var        nib(8)
flagReady      var        bit

init:
    sound BeepPin ,[200\200]                    'returns start Beep
    serout s_out,i9600,[" Init = ",dec Number,13]
    Prufen = 0 : flagInit = 0 :    flagReady = 0
clearIt:
       for x = 0 to 8
        Zahlen(x) = 0
            pause 50
            next
        Number    = 0  : i = 0 : x = 0:   modyf = 0
start:
    gosub collectNumbers
    if Number = 11 then init            ‘**start with * (Star)  All = 0   FlagInit = 1   
    if Number = 12 then checkPassword        'DTMF 12 = # = OK
goto start
collectNumbers:
LowLoop:
     if in11 = 0 then LowLoop        ‘in11 = StD-Pin = 1  ==> DTMF ton presand
pause 50                    'wait for Mt8870 ready
    Number = INL                     'INN0 not to use yet
    Zahlen(i) =  Number                'collect the Number in array Zahlen
        i = i + 1                   
HighLoop:
    if in"eleven" = 1 then HighLoop                    'loop till DTMF-Ton is finish
    sound BeepPin ,[DOk1\FOk1,dbr\0,DOk2\FOk2]        'returns O.K.Beep
        return

In my code:
if in"eleven" = 1 then HighLoop 'loop till DTMF-Ton is finish
If i write eleven as number 11
then there is an web page ERROR at basicmicro.net:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@forums.basicmicro.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.7a mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.13 Server at forums.basicmicro.net Port 80


Last edited by HSchwenk on Sat Oct 16, 2010 7:01 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Wrong Numbers…I don’t see why
PostPosted: Sat Oct 16, 2010 6:49 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Hard to say. The only thing that changed number is to set it to zero... Probably something in your function CollectNumbers?


Top
 Profile  
 
 Post subject: Re: Wrong Numbers…I don’t see why
PostPosted: Sat Oct 16, 2010 7:11 am 
Offline
Citizen

Joined: Wed Mar 13, 2002 11:00 am
Posts: 32
Hi Kurt
Oh you are very quick..!!
did you see my topic when I finished it ?
Because of an web Page Error I had to edit the topic several times.
My be you did not see my collectNumbers subroutine..?
Heinz


Top
 Profile  
 
 Post subject: Re: Wrong Numbers…I don’t see why
PostPosted: Sat Oct 16, 2010 10:31 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
My guess is the issues is that I believe: INL
returns 8 bits of data for P0-P7, so I am not sure what is connected to the other 4 pins or the like. In cases like this I will normally always simply do something like:
Number = INL & 0xf ' Only use the bits you are interested in...

Kurt


Top
 Profile  
 
 Post subject: Re: Wrong Numbers…I don’t see why
PostPosted: Sat Oct 16, 2010 12:31 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 9:06 am
Posts: 120
Location: Wisconsin USA
If you still haven't fixed it, add a 10ms pause
pause 10
Before and after serial commands.
I don't know why, but when i have a small pause before and after serial commands it cleans up a lot of signal problems.
The 10 ms pause should be short enough not to get in the way either.

Though i'm not 100% sure i understand the problem.

Is it that the nano is reading the wrong numbers, or transmitting the wrong numbers?

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Wrong Numbers…I don’t see why
PostPosted: Tue Oct 19, 2010 9:22 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
If you need 4 bits of a port you can use the nib variables instead of the byte variable. INA is P0 to P3.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO