Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:01 05 May 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 : QUESTION TO PORT COMMAND

Author Message
rentner111
Newbie

Joined: 18/03/2014
Location: Austria
Posts: 19
Posted: 09:23pm 25 Aug 2014
Copy link to clipboard 
Print this post

I have found when working with the PORT command, that the order of the port pins when reading and writing is different. Why is that?
example: PIN1=D0 PIN2=D1 PIN3=D2 PIN4=D3

When reading:
Levels at the PINs: 1-0-0-0
a = PORT(1.4)
print a = 1

In writing:
a = 1
PORT (1,4) = a
Levels at the PINs: 0-0-0-1

With thanks for an answer
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3663
Posted: 09:49pm 25 Aug 2014
Copy link to clipboard 
Print this post

Your input uses 1.4 -- is that right? A single floating point number?

JohnEdited by JohnS 2014-08-27
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 10:52pm 25 Aug 2014
Copy link to clipboard 
Print this post

Erwin, you seem to have found a glaring bug

It is so obvious that I am amazed that I never spotted it in testing, even more amazing is that no one else has spotted it since the PORT() function was introduced in V4.1 over two years ago.

What is going on here? Are you the first to have used the PORT() function?

I am sure that you are right but I am going off to test it - a fix will be in the next version.

Geoff

P.S. The bug is in the PORT() function, the bits returned are in reverse order. The port command is OK (but separately there is also a bug in the Maximite 4.5 version to be fixed).
Geoff Graham - http://geoffg.net
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 03:33am 26 Aug 2014
Copy link to clipboard 
Print this post

> Are you the first to have used the PORT() function?

Not for lack of trying I tried with 4.5. No go. Asked here and was refered to a previous post where the problem was declared a bug. That person had reloaded 4.4 and it worked. I tried 4.4A (perhaps the 'A' was the problem) and a different problem. When I tried to use PORT I'd get (IIRC) a 'pins not declared outputs' even though I had....

edit: oops ... function rather than commandEdited by hitsware 2014-08-27
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 04:17am 26 Aug 2014
Copy link to clipboard 
Print this post

Yes, as I said, there is a known bug in the Maximite version of the PORT command.

For a simple command/function it has a lot of issues

Geoff
Geoff Graham - http://geoffg.net
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 02:30pm 26 Aug 2014
Copy link to clipboard 
Print this post

I used the PORT command in the PRINTER sub that was developed here a while back with lots of input from others, and I never had a single issue with the command itself, if that is of any help. However, I was writing to the port using OC outputs. As I was never reading the port, this may have been why I never had any issues....
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5913
Posted: 04:44pm 26 Aug 2014
Copy link to clipboard 
Print this post

The only time I have used the PORT function is for the Coffee machine.
I do remember thinking at the time that the bit order was different to what I expected but didn't go back and investigate any further - the coffee machine does turn on.

It would only be if you are using the PORT command and function that the difference would be obvious.

Jim


VK7JH
MMedit   MMBasic Help
 
Print this page


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

© JAQ Software 2024