Go Back   PICAXE Forum > Main PICAXE Forum > Programming Editor Software
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Links: PICAXE Website PICAXE Manual Datasheets Online Store Software & Drivers

Reply
 
Thread Tools Display Modes
Old 05-02-2010, 15:23   #11
Technical
Technical Support
 
Join Date: Jan 1970
Location: Bath,UK
Posts: 4,351
Default

That is correct behaviour. The A0 etc are for 'readadc' commands only and only use values 0-255.

For 10 bit values with readadc10 you must use the generic option instead, which can handle numbers bigger than 255 as required by readadc10.
__________________
PICAXE Technical Support
Technical is offline   Reply With Quote
Old 07-02-2010, 20:30   #12
jsch2603
New Member
 
Join Date: Sep 2008
Location: WI, USA
Posts: 28
Default

Quote:
Because it uses a 28X1 model, when I2C is enabled pins 3 and 4 become dedicated to I2C which is correct for the 28X1 and also for PORTC of the 40X1, but that removes two of the input pins from the port 40X1 uses.
Bingo! Thanks all for pointing out this shortcoming with not having a dedicated 40X1 model. My first encounter w/ PICAXE was with the 40X1 and I had no prior experience with the lesser 28(X1), etc., therefore this came as a bit of a surprise. However, I don't recall seeing this issue w/ PE 5.6.2 and earlier though; and if that is the case, I'm still not clear on what has changed since with the model that this issue would now surface.

@ hippy: Considering the possibilities you mention (concerning the primary topic potential remedies), I'm thinking of two options at this point: Go back to PE 5.2.6, or upgrade to a 40X2. The 40X2 upgrade appears more practical to me, however, at a glance, I don't know how much work it will be to retrofit. I currently have the 40X1 mounted on an AXE022 board (see photo) and haven't looked/determined at this point if the pinout of the 40X2 is the same and/or what hardware modifications would be necessary to make the change. I also don't know at this point how much code modification would be required. I'm still pretty much a newbie at this, and time to work on the project further is somewhat limited.

The program pretty much does what I want it to do right now with some minor exceptions. I don't believe that I can post it here efficiently due to its size (119K). There's anywhere between 1000 and 1500 lines of code and the Memory used is currently = 3901 bytes out of 4096. There are over 255 hi2cout... command lines alone, so it appears impractical to "comment out i2c related code". Perhaps I can e-mail it as an attachment to you directly for some basic format evaluation in the interest of modifying it to work with either of the 40Xn series as you suggest, or perhaps better still, evaluate for conversion for use with the 40X2 alone? I'm certainly not the most learned or efficient programmer of this sort and I'm sure that there are more efficient ways to achieve the same code objectives or improve upon it. I would be grateful for any help along these lines, within reason of course; perhaps only as far as to offer suggestions would be of value I'm sure.

On a side note: I'm not sure at this point if the 40X2 provides any additional "fully functional" digital inputs (DI's) over the 40X1. I have utilized all such in this project including the portA pins as DI's, and as mentioned, portC (not fully functional, from the coding standpoint that is) is being used for i2c comms alone. I would like to gain at least an additional DI pin for the purpose of serin feedback control from the machine's uMP3 player; this alone may be justification enough for me to upgrade to the 40X2. Optionally, I haven't looked enough into utilizing/configuring one of the available I/O Expander (MCP23008) pins for this purpose, if indeed it is possible. All-in-all, I don't want to drift too far from the primary jist of this post and perhaps will address this matter in a separate, future main forum post if need be.
Attached Images
File Type: jpg P0001112.JPG (506.0 KB, 19 views)

Last edited by jsch2603 : 07-02-2010 at 20:45.
jsch2603 is offline   Reply With Quote
Old 08-02-2010, 00:13   #13
hippy
Technical Support
 
Join Date: Jan 1970
Location: UK
Posts: 13,555
Default

I'm sure there's never been a separate 40X or 40X1 model as I'm sure we'd not take it out if it were there. I could be wrong.

To convert 40X1 code to 40X2 you can use the Programming Editor X2 Conversion Wizard.

On the 40X1 all I/O pins ( except A.4 ) can be used as either input or output so that gives up to 39 inputs or 40 outputs.
hippy is offline   Reply With Quote
Old 08-02-2010, 16:42   #14
tiscando
Senior Member
 
Join Date: May 2008
Location: Merseyside, UK
Posts: 414
Default

Quote:
Originally Posted by hippy View Post
the 40X1 all I/O pins ( except A.4 ) can be used as either input or output so that gives up to 39 inputs or 40 outputs.
This is right for 40X2 but not 40X1...
__________________
Code:
symbol pinwherethealarmclockperhipheralontheothersideofthebedroomsendsanacknowledgementbackalongtheserialwireto = pin1
       ^
Error: Symbol too long - pinwherethealarmclockperhipheralontheothersideofthebedroomsendsanacknowledgementbackalongtheserialwireto
tiscando is offline   Reply With Quote
Old 12-02-2010, 01:17   #15
westaust55
Senior Member
 
Join Date: Mar 2008
Location: Western Australia
Posts: 4,974
Default

Quote:
Originally Posted by tiscando View Post
I think the root of this problem could be that there are still no seperate simulator modes for 28x1 and 40x1 so you couldn't seperately control PortD inputs if you are using the 40x1. But, I found there are seperate portD I/O for the 40x2. Using PE 5.2.9.
The need for a separate 40X1 simulator model was a topic that I have also raised many months ago.
Hope Rev Ed are listening/reading
__________________
:
westaust55

Hey Hamlet, 2B OR NOT 2B = $FF
westaust55 is offline   Reply With Quote
Old 13-02-2010, 07:56   #16
GreenLeader
Member
 
Join Date: Jan 2008
Location: Perth, Australia
Posts: 83
Default

Quote:
Originally Posted by Technical View Post
That is correct behaviour. The A0 etc are for 'readadc' commands only and only use values 0-255.

For 10 bit values with readadc10 you must use the generic option instead, which can handle numbers bigger than 255 as required by readadc10.
I am sure there is a good reason, but why can't the AO etc buttons simply generate numbers up to 1023 instead of just up to 255?
__________________
GREENLEADER
GreenLeader is offline   Reply With Quote
Old 13-02-2010, 11:36   #17
hippy
Technical Support
 
Join Date: Jan 1970
Location: UK
Posts: 13,555
Default

Don't forget that the educational sector is a target market for PICAXE and students often have very little programming or simulation experience. I suspect the rationale was that most people using simulation would be using READADC and only want and expect 0 to 255. Displaying 0 to 1023 and dividing by four or capping at 255 when READADC was used would create confusion for those people.
hippy is offline   Reply With Quote
Old 14-02-2010, 01:40   #18
GreenLeader
Member
 
Join Date: Jan 2008
Location: Perth, Australia
Posts: 83
Default

It hasn't really been a problem for me - I just use the generic input. Disadvantage is that all the ADC's read the same value.

Maybe another option is to put in a checkbox that allows you to choose between 8/10bit ADC's...
__________________
GREENLEADER
GreenLeader is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 16:53.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) Revolution Education Ltd 2007