to Technical: SFR access on upcoming 28X2?

womai

Senior Member
Important question: I noticed that the memory map (SFR) of the 18Fxx chips used for the 28X2/40X2 Picaxes is quite different form the 16Fxx map. In particular, while the 16F chips have all their registers between 0x00 and 0xff, the 18F series has them in an upper bank (up to 0xfff). The Picaxe manual says for the "poke" command:

"The second function of the poke command is for experinced users to write values to the internal microcontroller SFR (special function regsisters) (not 28X2)."

So does that mean there is no way to access advanced features of the 28X2? In my particular case I would be interested to modify the counter 2 prescaler to produce slow PWM frequencies (on the 16F series this needs a poke into register 0x12). But there is a variety of other possibilities I can think of.

So I would like to make a feature request - PLEASE extend the peek/poke commands to allow access to higher addresses (i.e. accept word variables for the address) or add special peek/poke versions to access those SFR registers on the 18F! Or is there a hard technical reason this cannot be done?

Wolfgang
 

demonicpicaxeguy

Senior Member
Important question: I noticed that the memory map (SFR) of the 18Fxx chips used for the 28X2/40X2 Picaxes is quite different form the 16Fxx map. In particular, while the 16F chips have all their registers between 0x00 and 0xff, the 18F series has them in an upper bank (up to 0xfff). The Picaxe manual says for the "poke" command:

"The second function of the poke command is for experinced users to write values to the internal microcontroller SFR (special function regsisters) (not 28X2)."

So does that mean there is no way to access advanced features of the 28X2? In my particular case I would be interested to modify the counter 2 prescaler to produce slow PWM frequencies (on the 16F series this needs a poke into register 0x12). But there is a variety of other possibilities I can think of.

So I would like to make a feature request - PLEASE extend the peek/poke commands to allow access to higher addresses (i.e. accept word variables for the address) or add special peek/poke versions to access those SFR registers on the 18F! Or is there a hard technical reason this cannot be done?

Wolfgang
with the current poke command the address is a byte value to address anything about that would require a word - i'm sure they'll have some way around it unless the values are offset
 

Dippy

Moderator
I can't see any problem. Addressing the SFR by name would be easier for programmers.
We'll have to wait and see......
 

hippy

Ex-Staff (retired)
AIUI the intention was/is to limit access to just GPR ( General Purpose RAM ) and not have any access to SFR.

There's an argument to support doing that - securing Intellectual Property - but it is a heavy handed approach and does have the consequence that clever tweaking will also be precluded. Arguably the X2's will provide the ability to 'do everything' from Basic and thus there's no need to have SFR access but I'm sure people will find they desire access to SFR in a way which isn't supported.

It shouldn't be too hard to extend PEEK and POKE to allow limited access to both GPR and selected SFR; a simple bit table can indicate which SFR's can be read or written which will protect IP and still be useful. Maybe add POKESFR and PEEKSFR commands ?

My vote is in favour of having access to all the on-chip peripheral control SFR's.
 

Technical

Technical Support
Staff member
The X2s will have 512 bytes of general purpose user ram.

One page of 256 bytes is accessed directly by b0-b47 (the lower 48 bytes) and/or indirectly by peek/poke (all 256 bytes).
The other page of 256 byes is accessed by the scratchpad put/get (and @ptr)

So peek/poke are only to access general purpose RAM on these chips.

However there will be an alternate method of tweaking peripherals...
 
Last edited:

MFB

Senior Member
It certainly helps, when planning future projects, to know these technical details in advance but so would an indication of the planned introduction date for this product.
 

womai

Senior Member
Given the furor last time Rev-Ed issued a target date for th X2's, I can understand their reluctance to repeat that experience. But in my case just knowing what the features will be helps me, because I can design my scope and its software in a way that will work for both (e.g. if I couldn't modify the prescaler then I'd have to think of other means of slowing down the PWM, and the ones I have come up so far are either a PITA or need additional external components).
 

Dippy

Moderator
Technical said: "However there will be an alternate method of tweaking peripherals..."

The PWM module is one of the PIC 'peripherals'.

So, go ahead and plan. And when the BIG DAY arrives you can change your pseudo-basic line for the New Command.... wossaproblem? After all , you can't go too far down a design route as we don't know what it looks like. Too much planning right now may be a little 'premature' methinks.

Or are you trying to wangle a prelim Data Sheet :) ??
 

demonicpicaxeguy

Senior Member
What PIC are they going to use dpg?
sorry i thought they'd already told us that i was thinking of the 20m and 14m's (i'm in fairy land today)

if i were to be placing bets though i would put my money somwhere around the 18f4550 for the 40x2

mostly because it's a popular chip it's reasonably priced and it's also got USB which i think might be somthing rev-ed could be keeping quiet on mostly because if we knew it had usb it would help us work out which chip they are going to use

as for the 28x2 i think somwhere between the pic18f2450 and the pic18f2550

and why not i'll even put a guess on the release date being somwhere around may or june this year

hey Technical.... do you want to throw somthing in to keep us guessing?
 
Last edited:

Tom2000

Senior Member
I'll be interested to see what they want for the 28X2.

The 28X1 is already at the top of my comfort level for "just something to play around with." I can't see RevEd asking any less for the 28X2.

Anything beyond the price of the 28X1 will be just a bit uncomfortable, unless I have some need that specifically requires the features of a 28X2.

Tom
 

hippy

Ex-Staff (retired)
I guess it's a case of Rev-Ed having to choose chips at a price which gives them the best mark-up while keeping their retail prices as low as possible.

Whereas we may buy chips ( or request samples ) in one offs on the principle of biggest is bestest and will fufil all our potential projects, commercial practice is usually to decide one's spec then find the cheapest product which supports it and add more if it has spare capacity, or, spot a niche, find out what will fill it and tailor the product to match that.

I'm sure Rev-Ed could deliver a real whizz-bang PICAXE if they put their mind to it, but the question is whether it could sell at a price customers would accept and secure the return on investment.
 

Dippy

Moderator
That'll have 'em reaching for their Data Sheets (not!).

Just because something like an 18F2550/4550 has a USB module on-board it doesn't mean that it happens like magic. Code/testing still needs to be written/done. Do you want to wait longer?
And hey, low speed USB can be done on many other PICs. You must have written some yourself in C? We all have I'm sure ;)

Maybe USB will be on the X3 (or the 28XDPG?) ..... sit back and relax mate. Take the weight (wait) off your feet :)
 

demonicpicaxeguy

Senior Member
That'll have 'em reaching for their Data Sheets (not!).

Just because something like an 18F2550/4550 has a USB module on-board it doesn't mean that it happens like magic. Code/testing still needs to be written/done. Do you want to wait longer?
And hey, low speed USB can be done on many other PICs. You must have written some yourself in C? We all have I'm sure ;)

Maybe USB will be on the X3 (or the 28XDPG?) ..... sit back and relax mate. Take the weight (wait) off your feet :)
i would have thought they would have been the obvious choice i wasn't far off anyway acording to Hippy,

what is so special about the C language really?
an IF statement compiled from C usaully comes out the same as an IF statement compiled in basic i really just don't like the syntax

i've actaully got my own crude basic compiler i cobbled together in vb, it's rather limited as far as the basic language is concerned and lacks things like soft serial routines but it's just as quick as every other compiler out there the downside is that it's limited to handfull of pics eg 16f628a 16f88 18f452 18f4550 18f8722

i'm doing another one for use with the pic32 series which will be fun just got to wait for them to show up
 

Dippy

Moderator
Learn C, pay the money and you'll programming your PIC32 this time tomorrow afternoon. Now that would be impressive!

A large aside: I notice that at least one manuf is now restricting/refusing samples to users with hotmail type email addresses and similar. Doesn't affect me thank goodness, but it looks like the freebie scroungers are having an effect! And it'll grow...
 

demonicpicaxeguy

Senior Member
i think Texas Instruments and Microchip took that up ages ago... doesn't affect me either i just stick everything on the good ole plastic (debit card) and 2 or 3 days later it's in my mailbox

i think the reason they took it up was because there were heaps of hotmail accounts setup specifically just to get the monthly allowance of samples from Microchip and Ti
 

Dippy

Moderator
"i think the reason they took it up was because there were heaps of hotmail accounts setup specifically just to get the monthly allowance of samples from Microchip and Ti"

- I think that is probably the reason. I blame it on Stan. He's always advocating scrounging freebies :)
 

Tom2000

Senior Member
I've got one request.

Just about every PIC has internal pullup resistors on almost every I/O pin.

Technical, would you please let us use them?

Thanks,

Tom
 

Mycroft2152

Senior Member
I guess it's a case of Rev-Ed having to choose chips at a price which gives them the best mark-up while keeping their retail prices as low as possible.

Whereas we may buy chips ( or request samples ) in one offs on the principle of biggest is bestest and will fufil all our potential projects, commercial practice is usually to decide one's spec then find the cheapest product which supports it and add more if it has spare capacity, or, spot a niche, find out what will fill it and tailor the product to match that.

I'm sure Rev-Ed could deliver a real whizz-bang PICAXE if they put their mind to it, but the question is whether it could sell at a price customers would accept and secure the return on investment.
I agree with Hippy.

DPG,

You keep missing the point. Rev-Ed's charter is to support the English education market, not the advanced hobbyists.

There are many things that Rev_Ed could do, but it doesn't make economic sense for their market.

If you doubt this marketing stategy, just look at the minor effort that was made in the US. PhAnderson brought the PICAXE in on his own for a few years, then Ed Services and now Sparkfun, none of which carry a full line.

Any improvements in the PICAXE line will be based on cost / performance improvements based on new chips.

So sit back and wait patiently, you are going to get what you get, when you get it.

If you can't wait, then learn C and you'll be able to use any chip you want.

Myc
 

Dippy

Moderator
Reckon I'm with you on that one Myc. Something for nothing.
I wonder why Microchip still make PICs which don't have USB modules?

Of course Rev-Ed could fill it up with features and then, as it gets more and more complicated and therefore into a different market, this forum will explode with students/hobbysists/humans getting even more confused.

In my humble and ignorant opinion I don't think it should get more sophisticated. SFR commands being my only exception. Study the intended market.... maybe PICAXEs with different facilities, regular and large, like you get with chips haha. (Doesn't work with 'fries' so sorry to my US cousins).

I don't even know whether to have a resistor in series with my LED any more :(
 

Wrenow

Senior Member
I agree with Hippy.

DPG,

You keep missing the point. Rev-Ed's charter is to support the English education market, not the advanced hobbyists.

..
Myc
And I say thank you to them for that, as well as sharing with the hobyists!

Cheers,

Wreno
 

demonicpicaxeguy

Senior Member
I agree with Hippy.

DPG,

You keep missing the point. Rev-Ed's charter is to support the English education market, not the advanced hobbyists.

Myc
the point i was trying to make was about usb vs a serial port is that a usb picaxe that allows a program download via usb instead of serial would be far less troublesome even in the classroom it would save using 2 resistors while at the same time avoiding the serial communications issues that seem to plaig people that are new to the concept
 

Mycroft2152

Senior Member
the point i was trying to make was about usb vs a serial port is that a usb picaxe that allows a program download via usb instead of serial would be far less troublesome even in the classroom it would save using 2 resistors while at the same time avoiding the serial communications issues that seem to plaig people that are new to the concept
DPG,

I agree, the 2 resistor serial download circuit is a real problem as shown by the large numbers of posts. The problem lies not withing the circuit itself. but how the pc manufacturees are applying and implimenting the RS-232 voltage standards to reduce the pc costs.

The 2 resistor download circuit can work but is is less than robust, but it is CHEAP. (Again targeted to the education market and school budgets).

From my experience, the PICAXE is the only micro that reccommends this interface. Most will reccommend a MAX232 buffer circuit, which can add $10+ US to the cost. Some will suggest a simple inverter / buffer circuit, either transitorised or using a logic chip, less expensive but still more than the xcost of 2 resistors.

I agree that a built in USB interface "would be nice" but the economics are just not there for the education markets.

DPG, I'm an sure you have calculated the difference in cost between a raw PIC and a PICAXE chip. That is where the money is made.

I really don't beleive, at this time, that REV_ED is going to add the cost of a built in USB interface to the PICAXE when they have publicly stated that just labelling the PICAXE chips would increase the price beyond the market.

Just my thoughts at 4 AM.

Myc
 

Mycroft2152

Senior Member
And I say thank you to them for that, as well as sharing with the hobyists!

Cheers,

Wreno
Wreno,

I really don"t think that Rev_Ed is "sharing" with the hobbyists. The hoobysit market just happens to be a bonus revenue stream. Again, remember Rev_Ed's charter, the reason they were created and the source of financing.


Hobbyists have always ridden on the coattails of mainstream technology.

Again, the hobbyist market is not there to support the R&D budgets. do you really think that Microchip is selling 3 billion chips a year to the hobbyist market?


Myc
 

Dippy

Moderator
Looks like this will reach rabbit proportions without agreement doesn't it.

So, 2 resistors vs 1 capacitor (for Vusb). Wow. I worry that if people cannot wire up 2 resistors in the right place then even 1 capacitor maybe confusing - let alone getting the USB differential data lines the right way round. And then we'll also have the 'teachers' that don't know their ADCONs from their ANSELs.

DPG: You have written USB comms haven't you? So you know about the regular polling required to maintain connection? You know the extra coding required. When writing directly on the PIC the polling isn't too difficult, but can you imagine the complication when including it in an interpreter? I'm not saying impossible, just "Is it worth it?".
And you possibley know that all this stuff is a little more involved than waving your Magic Wand.

And then the dozens of postings 'cos .... the USB doesn't work... duff PICAXE... (2 weeks later)... oh my wires were upside down....thanx.

And you never know, maybe there is a USB version coming up.... yes, wouldn't it be nice: Plug'n'Play PICAXE - PICAXE 28PNP. Ah, but that sounds like a transistor with 25 extra legs - yes that would confuse. But it would be nice.

But for now dpg, part with $100ss , learn C and then write your own firmware, and then write an Editor and Compiler/Tokeniser , produce a Forum and provide support for the product all Free of Charge. Maybe the first post that you get will suggest that serial downloading is easier....

Or just get a FT-whatever and be done with it.
 

demonicpicaxeguy

Senior Member
Looks like this will reach rabbit proportions without agreement doesn't it.

So, 2 resistors vs 1 capacitor (for Vusb). Wow. I worry that if people cannot wire up 2 resistors in the right place then even 1 capacitor maybe confusing - let alone getting the USB differential data lines the right way round. And then we'll also have the 'teachers' that don't know their ADCONs from their ANSELs.

DPG: You have written USB comms haven't you? So you know about the regular polling required to maintain connection? You know the extra coding required. When writing directly on the PIC the polling isn't too difficult, but can you imagine the complication when including it in an interpreter? I'm not saying impossible, just "Is it worth it?".
And you possibley know that all this stuff is a little more involved than waving your Magic Wand.

And then the dozens of postings 'cos .... the USB doesn't work... duff PICAXE... (2 weeks later)... oh my wires were upside down....thanx.

And you never know, maybe there is a USB version coming up.... yes, wouldn't it be nice: Plug'n'Play PICAXE - PICAXE 28PNP. Ah, but that sounds like a transistor with 25 extra legs - yes that would confuse. But it would be nice.

But for now dpg, part with $100ss , learn C and then write your own firmware, and then write an Editor and Compiler/Tokeniser , produce a Forum and provide support for the product all Free of Charge. Maybe the first post that you get will suggest that serial downloading is easier....

Or just get a FT-whatever and be done with it.
point taken, implementing a usb interface and running tokenised code would be a pain to do, while not impossible, not really worth it for rev-ed to do at the current usb pic prices though,

i think we're both grown up enough to agree to disagree instead of using up space on rev-ed's server and debating endlessly (they must be down to their last few terrabytes be now surely)
 
Last edited:

Mycroft2152

Senior Member
point taken, implementing a usb interface and running tokenised code would be a pain to do, while not impossible, not really worth it for rev-ed to do at the current usb pic prices though,

i think we're both grown up enough to agree to disagree instead of using up space on rev-ed's server and debating endlessly (they must be down to their last few terrabytes be now surely)
DPG,

Does this mean we are actually going to get a brief respite form your posts about the lack of built in USB?

Dippy,

Let's start a pool to see how long it will be....
 

hippy

Ex-Staff (retired)
One of the good things about Rev-Ed is that they have demonstrably taken account of the Hobby market and I don't think we'd have such advanced capabilities if they hadn't, or they'd be that enthused if the eduction market were all they were interested in.

That said, I'm sure education is still their main revenue stream, so it's a good symbiotic relationship between Rev-Ed and hobbyists but it does have its limits.

As to USB ... I expect that will arrive when someone at Rev-Ed has some free time to spare (!), tilts their chair back and thinks, "USB, hmmm. How much is that 18F-whatever these days ?".
 

womai

Senior Member
Quite amusing to see how the topic drifts around when the thread gets long - and all I was asking for initially was to poke the PWM prescaler :rolleyes:

BTW, i think Rev-Ed is taking pretty good care of the hobbyist market - IMHO the Picaxe has the lowest entry barrier of all for newbies - cost is low (compare e.g. to Basic Stamp which is 10x the price, or Arduino, which always needs a full circuit board), complexity is low (2 resistors and a battery - compare that to a raw Pic or Atmel uC,which arguably are cheaper devices but have a steep learning curve for a novice).

Wolfgang
 
Last edited:

Tom2000

Senior Member
... Arduino, which always needs a full circuit board...
Not at all. An Arduino is as easy to slap into a circuit or onto a breadboard as a Picaxe.

The Arduino, a resonator, a few bypass caps, and you're up and running.

Tom
 

Dippy

Moderator
Uh oh, here we go... indicate right, we've turned off at another junction. Another 10 pages heading your way folks.

You did it on purpose womai, just to see how long you could keep it going for.

I'm just experimenting with the new micro-pipeline stache dual-port nPICPhoton. You don't need any circuit board. You just plug into a Router via MSB and the code downloads. On-board temp compensated Xtal. 10Msps ADC with a 2kB MSB buffer and a 256 byte serial buffer. Anorak supplied.
 
Top