Scratchpad conflicts?

matherp

Senior Member
Hi all

Please could you confirm if I understand this.

I want to use hsersetup in background receive mode. Now as I understand this, incoming data will just be stored sequentially in the scratchpad starting at location 0. When the pointer gets to 127 (20X2 or 28X1) it will automatically return to zero and keep receiving.

However, configuring a picaxe using hi2csetup to run in slave mode also uses the scratchpad as the transfer area.

What I want to do is have a background serial receive running which some foreground code is parsing into known locations that can then be read by another picaxe over i2c but it looks like this isn't possible.

Any workrounds or am I just missing something?

Thanks

Peter
 

hippy

Ex-Staff (retired)
High-speed serial will overwrite all scratchpad if given a free run and it receives enough data.

A workround may be to catch background serial receive with an interrupt, check 'hSerPtr' and reset it to zero before it has a chance to overwrite the top end of scratchpad. You'd need a bit of give on that as data may be arriving during that time so hSerPtr may rise above the limit you'd like. You may also render some data inaccessible to the foreground task depending on how and what it was expecting / parsing.

The best solution would likely be to have two PICAXE's, one dedicating scratchpad to background serial receive, the other to I2C Slave use, and having a mechanism to pass parsed data from the first to the second.
 
Top