Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: uM2(+): data logging - cheap fast & easy Post ReplyPost New Topic
<< Prev Page of 9 Next >>
Author
Message << Prev Topic | Next Topic >>
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 24 May 2016 at 6:03am | IP Logged Quote centrex

Yes please Peter for the 170.

Grogster do you have these little boards for sale?


Regards

__________________
Cliff


Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2340
Posted: 24 May 2016 at 7:08am | IP Logged Quote matherp

Quote:
Yes please Peter for the 170.


SPI1 version untested but should work. SPI2 version fully tested

CSub rewritepage 'SPI1 version
    00000000
    27BDFFC0 AFBF003C AFB70034 AFB5002C AFB40028 AFB30024 AFB20020 AFB1001C 
    AFBE0038 3C119D00 AFB60030 AFB00018 8E22003C 00809021 24041000 8CD30000 
    0040F809 00A0A021 8E430000 0040B821 8E22001C 24040001 3C11BF80 3C1500FF 
    00031A00 AE245830 24050005 02602021 36B5F000 30720FFF 0040F809 0075A824 
    24020003 AE225820 3C02BF80 8C435810 30630080 1060FFFD 0015B402 3C02BF80 
    8C435820 3C03BF80 AC565820 8C625810 30420080 1040FFFD 0015F203 3C02BF80 
    33DE00FF 8C435820 3C03BF80 AC5E5820 8C625810 30420080 1040FFFD 3C02BF80 
    32A300FF AFA30010 8FA40010 8C435820 3C03BF80 AC445820 8C625810 30420080 
    1040FFFD 3C02BF80 8C425820 02E08821 26E51000 02E02021 3C03BF80 AC705820 
    8C625810 30420080 1040FFFD 00000000 8C705820 A0900000 24840001 1485FFF7 
    26420100 0242102A 10400008 26420100 02E21021 02F29021 92830000 A2430000 
    26520001 1642FFFC 26940001 3C129D00 8E42001C 02602021 0040F809 24050006 
    8E42001C 02602021 0040F809 24050005 24030006 3C02BF80 AC435820 8C435810 
    30630080 1060FFFD 3C129D00 8E42001C 3C14BF80 02602021 24050006 8E835820 
    0040F809 00000000 8E42001C 02602021 0040F809 24050005 24020020 AE825820 
    3C02BF80 8C435810 30630080 1060FFFD 00000000 3C02BF80 8C435820 3C03BF80 
    AC565820 8C625810 30420080 1040FFFD 3C02BF80 8C435820 3C03BF80 AC5E5820 
    8C625810 30420080 1040FFFD 8FA40010 3C02BF80 8C435820 3C03BF80 AC445820 
    8C625810 30420080 1040FFFD 3C029D00 8C42001C 02602021 24050006 3C03BF80 
    8C635820 0040F809 3C149D00 3C12BF80 8E820004 0040F809 24040064 8E82001C 
    02602021 0040F809 24050005 24020005 AE425820 8E425810 30420080 1040FFFD 
    00000000 8E425820 AE505820 8E425810 30420080 1040FFFD 00000000 8E505820 
    8E82001C 02602021 0040F809 24050006 32020001 5440FFE7 8E820004 26BE1000 
    02BE102A 1040005E 02A0B021 3C129D00 3C10BF80 24150006 8E42001C 02602021 
    0040F809 24050005 AE155820 8E025810 30420080 1040FFFD 02602021 8E42001C 
    02A02821 8E035820 0040F809 00000000 8E42001C 02602021 0040F809 24050005 
    24020002 AE025820 8E025810 30420080 1040FFFD 7EC23C00 8E035820 AE025820 
    8E025810 30420080 1040FFFD 7EC23A00 8E035820 AE025820 8E025810 30420080 
    1040FFFD 32C200FF 8E035820 AE025820 8E025810 30420080 1040FFFD 00000000 
    8E025820 26230100 92220000 AE025820 8E025810 30420080 1040FFFD 00000000 
    26310001 8E025820 5623FFF8 92220000 8E42001C 02602021 0040F809 02A02821 
    24140100 8E420004 0040F809 24040064 8E42001C 02602021 0040F809 24050005 
    24020005 AE025820 8E025810 30420080 1040FFFD 00000000 8E025820 AE145820 
    8E025810 30420080 1040FFFD 00000000 8E145820 8E42001C 02602021 0040F809 
    02A02821 32820001 5440FFE7 8E420004 26D60100 02DE102A 5440FFA8 8E42001C 
    3C029D00 8C420044 0040F809 02E02021 8FBF003C 8FBE0038 8FB70034 8FB60030 
    8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0040 
End CSub


CSub rewritepage 'SPI2 version
    00000000
    27BDFFC0 AFBF003C AFB70034 AFB5002C AFB40028 AFB30024 AFB20020 AFB1001C 
    AFBE0038 3C119D00 AFB60030 AFB00018 8E22003C 00809021 24041000 8CD30000 
    0040F809 00A0A021 8E430000 0040B821 8E22001C 24040001 3C11BF80 3C1500FF 
    00031A00 AE245A30 24050005 02602021 36B5F000 30720FFF 0040F809 0075A824 
    24020003 AE225A20 3C02BF80 8C435A10 30630080 1060FFFD 0015B402 3C02BF80 
    8C435A20 3C03BF80 AC565A20 8C625A10 30420080 1040FFFD 0015F203 3C02BF80 
    33DE00FF 8C435A20 3C03BF80 AC5E5A20 8C625A10 30420080 1040FFFD 3C02BF80 
    32A300FF AFA30010 8FA40010 8C435A20 3C03BF80 AC445A20 8C625A10 30420080 
    1040FFFD 3C02BF80 8C425A20 02E08821 26E51000 02E02021 3C03BF80 AC705A20 
    8C625A10 30420080 1040FFFD 00000000 8C705A20 A0900000 24840001 1485FFF7 
    26420100 0242102A 10400008 26420100 02E21021 02F29021 92830000 A2430000 
    26520001 1642FFFC 26940001 3C129D00 8E42001C 02602021 0040F809 24050006 
    8E42001C 02602021 0040F809 24050005 24030006 3C02BF80 AC435A20 8C435A10 
    30630080 1060FFFD 3C129D00 8E42001C 3C14BF80 02602021 24050006 8E835A20 
    0040F809 00000000 8E42001C 02602021 0040F809 24050005 24020020 AE825A20 
    3C02BF80 8C435A10 30630080 1060FFFD 00000000 3C02BF80 8C435A20 3C03BF80 
    AC565A20 8C625A10 30420080 1040FFFD 3C02BF80 8C435A20 3C03BF80 AC5E5A20 
    8C625A10 30420080 1040FFFD 8FA40010 3C02BF80 8C435A20 3C03BF80 AC445A20 
    8C625A10 30420080 1040FFFD 3C029D00 8C42001C 02602021 24050006 3C03BF80 
    8C635A20 0040F809 3C149D00 3C12BF80 8E820004 0040F809 24040064 8E82001C 
    02602021 0040F809 24050005 24020005 AE425A20 8E425A10 30420080 1040FFFD 
    00000000 8E425A20 AE505A20 8E425A10 30420080 1040FFFD 00000000 8E505A20 
    8E82001C 02602021 0040F809 24050006 32020001 5440FFE7 8E820004 26BE1000 
    02BE102A 1040005E 02A0B021 3C129D00 3C10BF80 24150006 8E42001C 02602021 
    0040F809 24050005 AE155A20 8E025A10 30420080 1040FFFD 02602021 8E42001C 
    02A02821 8E035A20 0040F809 00000000 8E42001C 02602021 0040F809 24050005 
    24020002 AE025A20 8E025A10 30420080 1040FFFD 7EC23C00 8E035A20 AE025A20 
    8E025A10 30420080 1040FFFD 7EC23A00 8E035A20 AE025A20 8E025A10 30420080 
    1040FFFD 32C200FF 8E035A20 AE025A20 8E025A10 30420080 1040FFFD 00000000 
    8E025A20 26230100 92220000 AE025A20 8E025A10 30420080 1040FFFD 00000000 
    26310001 8E025A20 5623FFF8 92220000 8E42001C 02602021 0040F809 02A02821 
    24140100 8E420004 0040F809 24040064 8E42001C 02602021 0040F809 24050005 
    24020005 AE025A20 8E025A10 30420080 1040FFFD 00000000 8E025A20 AE145A20 
    8E025A10 30420080 1040FFFD 00000000 8E145A20 8E42001C 02602021 0040F809 
    02A02821 32820001 5440FFE7 8E420004 26D60100 02DE102A 5440FFA8 8E42001C 
    3C029D00 8C420044 0040F809 02E02021 8FBF003C 8FBE0038 8FB70034 8FB60030 
    8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0040 
End CSub


Edited by matherp on 24 May 2016 at 7:56am
Back to Top View matherp's Profile Search for other posts by matherp
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 24 May 2016 at 10:08am | IP Logged Quote Grogster

centrex wrote:
Grogster do you have these little boards for sale?


They are not on the website, but I can sell you some if you want any.
Flick me a PM if you want some. If anyone else reading this thinks they should be on my website, let me know and I can add them.

US$5 for two including airmail to anywhere on the planet.

They are designed to fit a standard 12-pin edge-connector socket such as these ones.



Edited by Grogster on 24 May 2016 at 10:08am


__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 02 June 2016 at 8:07am | IP Logged Quote centrex

@ Grogster the little memory board works aok thanks.

matherp the logging program works like a charm on a 28 pin pic170 a thousand items in 19 seconds.
But the SPI1 rewritepage cfunction won't using grogsters test code snippet.

Can you have a look at the function and perhaps check it out if you have the time.
Thanks.

Edited by centrex on 02 June 2016 at 8:08am


__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 02 June 2016 at 9:36am | IP Logged Quote Grogster

What happens when you try to call rewritepage?
Does the MM come back with an error or just crash?

I am using a MM+ 64-pin QFP chip, not the 170 DIL, so that might make all the difference.

Thanks for letting me know the board works for you.

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2340
Posted: 02 June 2016 at 10:03am | IP Logged Quote matherp

Quote:
But the SPI1 rewritepage cfunction won't using grogsters test code snippet


Sounds like you don't have a self-consistent set of Cfunctions for MX170 SPI1

Here is my test program for paged rewrite which tests fine on SPI1 44-pin

Migrate this complete set of CFunction into Grogster's program and it should work


option explicit   
option default none   
dim integer i   
const chipselectpin%=19 'chip select pin   
dim s$ ,d$ ,t$

'   
'  Example program to demonstrate page mode access to a serial flash chip mounted on a SSD1963  
'  Compatible with 28 and 44 pin MM2 processors  SPI1
'   
testdata() 'sets up the testdata generator   
'   
initchip(1,chipselectpin%) 'iniitialise the chip with full erase
s$=space$(255)  '   
for i=100 to 200 
  writepage(i,s$,chipselectpin%)   'write out a page of spaces
  d$="spoil" 'make sure we can't cheat
  readpage(i,d$,chipselectpin%)   'read in the page
  if d$<>s$ then 'prove the page is all spaces
    print "error in read 1"
    end
  endif
  t$=int2Text(i) 
  t$=t$+space$(255-len(t$)) 
  timer = 0
  rewritepage(i,t$,chipselectpin%) 'rewrite the page
  if i=10 then print timer
  readpage(i,d$,chipselectpin%)   'read in the updated page
  if d$<>t$ then 'prove the page is as written
    print "error in read 2"
    end
  endif
next i  
for i=100 to 200
  readpage(i,d$,chipselectpin%)   'read in the updated page
  print d$  
next i
end   
'   
'****************************************   


sub initchip(eraseit as integer, cspin as integer)
  local integer i=getpagecount(d$,cspin)*256
  if eraseit then
    if not (erasechip(i,chipselectpin%)) then  
      print "erase failed"  
      end  
    endif  
    print "Erase complete" 
  endif
end sub
'
CFunction getnextfreepage
    00000000
    27BDFEC8 AFB7012C AFBF0134 AFBE0130 AFB60128 AFB50124 AFB40120 AFB3011C 
    AFB20118 AFB10114 AFB00110 8C830004 8C820000 8CB60000 000327C3 308407FF 
    00821021 0044B82B 02E3B821 000212C2 0017BD40 02E2B825 24030001 3C02BF80 
    AC435830 1AE00048 0000A021 3C159D00 3C10BF80 241E0003 27B20110 24130020 
    8EA2001C 02C02021 0040F809 24050005 00141A00 AE1E5820 8E025810 30420080 
    1040FFFD 7C623C00 8E045820 AE025820 8E025810 30420080 1040FFFD 7C623A00 
    8E045820 AE025820 8E025810 30420080 1040FFFD 00000000 306300FF 8E025820 
    AE035820 8E025810 30420080 1040FFFD 00000000 8E025820 27A30010 AE115820 
    8E025810 30420080 1040FFFD 00000000 8E115820 7C118C20 A0710000 24630001 
    1472FFF6 02C02021 8EA2001C 0040F809 24050006 8FA20010 8FA30014 00431025 
    14400012 00002021 27A20018 24040001 8C430000 8C450004 00651825 1460000B 
    24420008 24840001 5493FFFA 8C430000 26940001 0297102A 5440FFC2 8EA2001C 
    10000002 24040100 00002021 27A30010 000410C0 00621021 8C460000 8C450004 
    30C30001 14600011 00001021 24020001 00055840 240A0040 00024827 00461806 
    012B4804 30480020 00453807 01231825 00E8180B 30630001 54600005 0014A140 
    24420001 144AFFF5 00024827 0014A140 02842021 8FBF0134 00042180 00441021 
    00021FC3 8FBE0130 8FB7012C 8FB60128 8FB50124 8FB40120 8FB3011C 8FB20118 
    8FB10114 8FB00110 03E00008 27BD0138 
End CFunction
'
CFunction getpagecount
    00000000
    27BDFFC8 AFB30028 AFBF0034 AFB50030 AFB4002C AFB20024 AFB10020 AFB0001C 
    8CB10000 3C029D00 8C420088 00111880 00621021 8C420000 24030008 10430007 
    00809821 3C029D00 8C420010 02202021 24050008 0040F809 00003021 3C02BF81 
    8C44F220 3C030661 3463A053 7C84D800 1083000B 24020050 3C02BF81 8C43F220 
    3C020660 3442A053 7C63D800 00621026 2404000C 24030050 0082180B 00601021 
    3C039D00 8C630088 00431021 8C430000 24020065 1062008E 3C02BF81 8C45F220 
    3C030661 3C029D00 7CA5D800 3463A053 8C420010 10A3000B 24040014 3C03BF81 
    8C64F220 3C030660 3463A053 7C84D800 00832026 24050003 24030014 00A4180B 
    00602021 24050008 0040F809 00003021 3C02BF81 8C45F220 3C030661 3C029D00 
    7CA5D800 3463A053 8C420010 10A3000B 24040014 3C03BF81 8C64F220 3C030660 
    3463A053 7C84D800 00832026 24050003 24030014 00A4180B 00602021 24050064 
    0040F809 00003021 3C02BF81 8C45F220 3C030661 3C029D00 7CA5D800 3463A053 
    8C420010 10A3000B 24040029 3C03BF81 8C64F220 3C030660 3463A053 7C84D800 
    00832026 2405000E 24030029 00A4180B 00602021 24050002 0040F809 00003021 
    3C02BF81 8C45F220 3C030661 3C029D00 7CA5D800 3463A053 8C420010 10A3000B 
    24040029 3C03BF81 8C64F220 3C030660 3463A053 7C84D800 00832026 2405000E 
    24030029 00A4180B 00602021 24050064 0040F809 00003021 3C02BF81 8C45F220 
    3C030661 3C029D00 7CA5D800 3463A053 8C420010 10A3000B 2404000E 3C03BF81 
    8C64F220 3C030660 3463A053 7C84D800 00832026 24050019 2403000E 00A4180B 
    00602021 24050008 0040F809 00003021 3C02BF81 8C45F220 3C030661 3C029D00 
    7CA5D800 3463A053 8C420010 10A3000B 2404000E 3C03BF81 8C64F220 3C030660 
    3463A053 7C84D800 00832026 24050019 2403000E 00A4180B 00602021 24050064 
    0040F809 00003021 3C03BF81 8C64FA84 24050001 3C02BF81 7CA41804 AC64FA84 
    8C43FB04 24040003 7C831804 AC43FB04 3C029D00 8C42001C 02202021 0040F809 
    24050006 3C02BF80 34038060 24040C00 AC435800 AC445840 24040001 AC445830 
    3C03BF80 AC405820 8C625810 30420080 1040FFFD 3C029D00 8C42001C 3C10BF80 
    02202021 24050005 8E125820 0040F809 00000000 2402009F AE025820 3C03BF80 
    8C625810 30420080 1040FFFD 3C02BF80 8C435820 3C03BF80 AC405820 8C625810 
    30420080 1040FFFD 3C02BF80 8C505820 3C03BF80 AC405820 8C625810 30420080 
    1040FFFD 3C02BF80 8C555820 3C03BF80 AC525820 8C625810 30420080 1040FFFD 
    3C129D00 8E42001C 3C03BF80 02202021 24050006 8C745820 0040F809 00108200 
    24020010 AFA20010 02158021 8E420030 00108200 02148021 26640001 02003021 
    0040F809 00103FC3 3C02FF40 3442D9BF 02021021 24030006 2C420002 10400027 
    A2630000 3C029D00 8C42001C 02202021 0040F809 24050005 24030006 3C02BF80 
    AC435820 3C03BF80 8C625810 30420080 1040FFFD 3C129D00 8E42001C 3C13BF80 
    02202021 24050006 8E635820 0040F809 00000000 8E42001C 02202021 0040F809 
    24050005 24020098 AE625820 3C03BF80 8C625810 30420080 1040FFFD 3C029D00 
    8C42001C 3C03BF80 02202021 24050006 8C635820 0040F809 00000000 3C0200BF 
    24422642 24044000 12020012 00002821 3C0200BF 24422602 1202000E 3C0200BF 
    24422641 1202000B 24042000 3C0200BF 24422601 12020006 2694FFF8 24020001 
    0282A004 02802021 10000002 00142FC3 00002821 8FBF0034 00801021 00A01821 
    8FB50030 8FB4002C 8FB30028 8FB20024 8FB10020 8FB0001C 03E00008 27BD0038 
End CFunction
'
CFunction erasechip
    00000000
    27BDFFD8 AFB40020 AFB00010 AFBF0024 AFB3001C AFB20018 AFB10014 8CB30000 
    3C029D00 8C42001C 24030001 3C10BF80 AE035830 0080A021 24050005 0040F809 
    02602021 24020006 AE025820 3C03BF80 8C625810 30420080 1040FFFD 3C109D00 
    8E02001C 3C11BF80 02602021 24050006 8E235820 0040F809 00000000 8E02001C 
    02602021 0040F809 24050005 240200C7 AE225820 3C03BF80 8C625810 30420080 
    1040FFFD 3C029D00 8C42001C 02602021 24050006 3C03BF80 8C635820 0040F809 
    3C119D00 3C10BF80 8E220004 0040F809 3404C350 8E22001C 02602021 0040F809 
    24050005 24020005 AE025820 8E025810 30420080 1040FFFD 00000000 8E025820 
    AE125820 8E025810 30420080 1040FFFD 00000000 8E125820 8E22001C 02602021 
    7C129420 0040F809 24050006 32420001 5440FFE6 8E220004 3C029D00 8C42001C 
    02602021 0040F809 24050005 24030003 3C02BF80 AC435820 3C03BF80 8C625810 
    30420080 1040FFFD 3C02BF80 8C435820 3C03BF80 AC405820 8C625810 30420080 
    1040FFFD 3C02BF80 8C435820 3C03BF80 AC405820 8C625810 30420080 1040FFFD 
    3C02BF80 8C435820 3C03BF80 AC405820 8C625810 30420080 1040FFFD 00000000 
    8E820004 3C03BF80 8C635820 5C400006 3C02BF80 14400014 3C029D00 8E820000 
    10400010 3C02BF80 AC525820 3C03BF80 8C625810 30420080 1040FFFD 3C029D00 
    8C42001C 02602021 24050006 3C03BF80 8C635820 0040F809 00000000 10000007 
    00001021 3C029D00 8C42001C 02602021 0040F809 24050006 24020001 8FBF0024 
    8FB40020 8FB3001C 8FB20018 8FB10014 8FB00010 03E00008 27BD0028 
End CFunction
'
CSub writepage
    00000000
    27BDFFD8 AFB3001C AFB10014 AFB00010 AFBF0024 AFB40020 AFB20018 8CD30000 
    3C029D00 8C42001C 8C940000 24030001 3C10BF80 AE035830 00A08821 02602021 
    0040F809 24050005 24020006 0014A200 AE025820 3C03BF80 8C625810 30420080 
    1040FFFD 3C109D00 8E02001C 3C12BF80 02602021 24050006 8E435820 0040F809 
    00000000 8E02001C 02602021 0040F809 24050005 24020002 AE425820 3C03BF80 
    8C625810 30420080 1040FFFD 3C02BF80 7E843C00 8C435820 3C03BF80 AC445820 
    8C625810 30420080 1040FFFD 3C02BF80 7E943A00 8C435820 3C03BF80 AC545820 
    8C625810 30420080 1040FFFD 3C02BF80 8C435820 3C03BF80 AC405820 8C625810 
    30420080 1040FFFD 3C02BF80 8C425820 00008021 3C03BF80 24040100 02301021 
    80420000 AC625820 8C625810 30420080 1040FFFD 00000000 26100001 8C625820 
    1604FFF7 02301021 3C029D00 8C42001C 02602021 0040F809 24050006 3C129D00 
    3C11BF80 8E420004 0040F809 24040064 8E42001C 02602021 0040F809 24050005 
    24020005 AE225820 8E225810 30420080 1040FFFD 00000000 8E225820 AE305820 
    8E225810 30420080 1040FFFD 00000000 8E305820 8E42001C 02602021 0040F809 
    24050006 32020001 5440FFE7 8E420004 8FBF0024 8FB40020 8FB3001C 8FB20018 
    8FB10014 8FB00010 03E00008 27BD0028 
End CSub
'
CSub readpage
    00000000
    27BDFFD8 AFB3001C AFB20018 AFB10014 AFBF0024 AFB40020 AFB00010 8CD20000 
    3C029D00 8C42001C 8C940000 24030001 3C13BF80 AE635830 00A08821 02402021 
    0040F809 24050005 24020003 0014A200 AE625820 3C03BF80 8C625810 30420080 
    1040FFFD 3C02BF80 7E843C00 8C435820 3C03BF80 AC445820 8C625810 30420080 
    1040FFFD 3C02BF80 7E943A00 8C435820 3C03BF80 AC545820 8C625810 30420080 
    1040FFFD 3C02BF80 8C435820 3C03BF80 AC405820 8C625810 30420080 1040FFFD 
    3C02BF80 8C425820 00002021 3C03BF80 24050100 AC705820 8C625810 30420080 
    1040FFFD 00000000 8C705820 02241021 24840001 1485FFF7 A0500000 3C029D00 
    8C42001C 02402021 0040F809 24050006 8FBF0024 8FB40020 8FB3001C 8FB20018 
    8FB10014 8FB00010 03E00008 27BD0028 
End CSub
'
CSub rewritepage
    00000000
    27BDFFC0 AFBF003C AFB70034 AFB5002C AFB40028 AFB30024 AFB20020 AFB1001C 
    AFBE0038 3C119D00 AFB60030 AFB00018 8E22003C 00809021 24041000 8CD30000 
    0040F809 00A0A021 8E430000 0040B821 8E22001C 24040001 3C11BF80 3C1500FF 
    00031A00 AE245830 24050005 02602021 36B5F000 30720FFF 0040F809 0075A824 
    24020003 AE225820 3C02BF80 8C435810 30630080 1060FFFD 0015B402 3C02BF80 
    8C435820 3C03BF80 AC565820 8C625810 30420080 1040FFFD 0015F203 3C02BF80 
    33DE00FF 8C435820 3C03BF80 AC5E5820 8C625810 30420080 1040FFFD 3C02BF80 
    32A300FF AFA30010 8FA40010 8C435820 3C03BF80 AC445820 8C625810 30420080 
    1040FFFD 3C02BF80 8C425820 02E08821 26E51000 02E02021 3C03BF80 AC705820 
    8C625810 30420080 1040FFFD 00000000 8C705820 A0900000 24840001 1485FFF7 
    26420100 0242102A 10400008 26420100 02E21021 02F29021 92830000 A2430000 
    26520001 1642FFFC 26940001 3C129D00 8E42001C 02602021 0040F809 24050006 
    8E42001C 02602021 0040F809 24050005 24030006 3C02BF80 AC435820 8C435810 
    30630080 1060FFFD 3C129D00 8E42001C 3C14BF80 02602021 24050006 8E835820 
    0040F809 00000000 8E42001C 02602021 0040F809 24050005 24020020 AE825820 
    3C02BF80 8C435810 30630080 1060FFFD 00000000 3C02BF80 8C435820 3C03BF80 
    AC565820 8C625810 30420080 1040FFFD 3C02BF80 8C435820 3C03BF80 AC5E5820 
    8C625810 30420080 1040FFFD 8FA40010 3C02BF80 8C435820 3C03BF80 AC445820 
    8C625810 30420080 1040FFFD 3C029D00 8C42001C 02602021 24050006 3C03BF80 
    8C635820 0040F809 3C149D00 3C12BF80 8E820004 0040F809 24040064 8E82001C 
    02602021 0040F809 24050005 24020005 AE425820 8E425810 30420080 1040FFFD 
    00000000 8E425820 AE505820 8E425810 30420080 1040FFFD 00000000 8E505820 
    8E82001C 02602021 0040F809 24050006 32020001 5440FFE7 8E820004 26BE1000 
    02BE102A 1040005E 02A0B021 3C129D00 3C10BF80 24150006 8E42001C 02602021 
    0040F809 24050005 AE155820 8E025810 30420080 1040FFFD 02602021 8E42001C 
    02A02821 8E035820 0040F809 00000000 8E42001C 02602021 0040F809 24050005 
    24020002 AE025820 8E025810 30420080 1040FFFD 7EC23C00 8E035820 AE025820 
    8E025810 30420080 1040FFFD 7EC23A00 8E035820 AE025820 8E025810 30420080 
    1040FFFD 32C200FF 8E035820 AE025820 8E025810 30420080 1040FFFD 00000000 
    8E025820 26230100 92220000 AE025820 8E025810 30420080 1040FFFD 00000000 
    26310001 8E025820 5623FFF8 92220000 8E42001C 02602021 0040F809 02A02821 
    24140100 8E420004 0040F809 24040064 8E42001C 02602021 0040F809 24050005 
    24020005 AE025820 8E025810 30420080 1040FFFD 00000000 8E025820 AE145820 
    8E025810 30420080 1040FFFD 00000000 8E145820 8E42001C 02602021 0040F809 
    02A02821 32820001 5440FFE7 8E420004 26D60100 02DE102A 5440FFA8 8E42001C 
    3C029D00 8C420044 0040F809 02E02021 8FBF003C 8FBE0038 8FB70034 8FB60030 
    8FB5002C 8FB40028 8FB30024 8FB20020 8FB1001C 8FB00018 03E00008 27BD0040 
End CSub






'


'   
'****************************   
' test data generation   
'   
'small   
sub testdata   
  DATA "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"   
  DATA "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"   
'tens   
  DATA "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"   
'big   
  DATA "thousand", "million", "billion"   
  dim small(19) AS STRING length 10, tens(7) AS STRING length 10, big(2) AS STRING length 10   
  FOR i = 1 TO 19   
    READ small(i)   
  NEXT   
  FOR i = 0 TO 7   
    READ tens(i)   
  NEXT   
  FOR i = 0 TO 2   
    READ big(i)   
  NEXT   
'   
end sub   
.   
FUNCTION int2Text(number AS integer) as string   
    local num AS integer, outP AS STRING length 60, unit AS INTEGER   
    local tmpLng1 AS integer   
    
    IF 0 = number THEN   
        int2Text = "zero"   
        EXIT FUNCTION   
    END IF   
    
    num = ABS(number)   
    
    DO   
        tmpLng1 = num MOD 100   
        SELECT CASE tmpLng1   
            CASE 1 TO 19   
                outP = small(tmpLng1) + " " + outP   
            CASE 20 TO 99   
                SELECT CASE tmpLng1 MOD 10   
                    CASE 0   
                        outP = tens((tmpLng1 \ 10) - 2) + " " + outP   
                    CASE ELSE   
                        outP = tens((tmpLng1 \ 10) - 2) + "-" + small(tmpLng1 MOD 10) + " " + outP   
                END SELECT   
        END SELECT   
    
        tmpLng1 = (num MOD 1000) \ 100   
        IF tmpLng1 THEN   
            outP = small(tmpLng1) + " hundred " + outP   
        END IF   
    
        num = num \ 1000   
        IF num < 1 THEN EXIT DO   
    
        tmpLng1 = num MOD 1000   
        IF tmpLng1 THEN outP = big(unit) + " " + outP   
    
        unit = unit + 1   
    LOOP   
    
    IF number < 0 THEN outP = "negative " + outP   
    Do WHILE ASC(RIGHT$(outp,1))<=32   
       outp = LEFT$(outp,len(outp)-1)    
    loop   
    int2Text = outP   
END FUNCTION   
'*********************************
Back to Top View matherp's Profile Search for other posts by matherp
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 02 June 2016 at 10:10am | IP Logged Quote centrex

Thanks Peter I will give it a try.

All works !


Does this mean we need the original program for data logging and this new piece if we only want to load or modify specific locations.

Thanks again.


Edited by centrex on 02 June 2016 at 8:47pm


__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
Phil23
Guru
Guru


Joined: 27 March 2016
Location: Australia
Online Status: Offline
Posts: 1510
Posted: 02 June 2016 at 9:22pm | IP Logged Quote Phil23

This thread take a lot of digesting for an inexperienced & rusty brain.
I'm sure it can do basic things I could use.

Would someone be able to paste together a very simple example that just saves & then reads back a couple of variables and maybe an array; if that's something that can easily be done.

Have read thru it a few times, but it's still being a huge learning curve to interpret it and figure out how to apply it to the example above.

Thanks

Phil
Back to Top View Phil23's Profile Search for other posts by Phil23
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 03 June 2016 at 12:47am | IP Logged Quote centrex

Hi Phil
This total thread is for one particular chip as noted by Matherp on page 1.

It works very well and using the commands and looking at how Matherp loaded the 1000 item data base will give you an idea of what to do. I have it running on the 28 pin micromite and while I dont fully understand the demo programs we are getting there.

__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6128
Posted: 03 June 2016 at 1:10am | IP Logged Quote Grogster

centrex wrote:
Does this mean we need the original program for data logging and this new piece if we only want to load or modify specific locations.


I asked matherp for the changes to suit my purposes(and complicate matters), which was to be able to simply page read/write at any location in the chip, at any time, which required his guru C-brain to rustle up the page rewrite sub to read and rewrite the block with the page I wanted to change.

This was MY complication of things, so I would expect that the answer depends on what you want to do.

If you want to just do logging as matherp's original concept stood, then I would stick with his original code examples I would think.

If you want to be able to write any page in the memory, then come along at random and rewrite any page at random(including the same page you just wrote), then you will need the rewrite routine.

matherp will probably explain his concept better then I.

EDIT: @ Phil23 - I can put together an example. How many variables are you wanting to save so I know how many to cater for in the example?

Edited by Grogster on 03 June 2016 at 1:12am


__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
matherp
Guru
Guru


Joined: 11 December 2012
Location: United Kingdom
Online Status: Offline
Posts: 2340
Posted: 03 June 2016 at 7:08am | IP Logged Quote matherp

Quote:
Does this mean we need the original program for data logging and this new piece if we only want to load or modify specific locations.


Yes, the original program stands alone. The new CFunction was done for Grogster (but can be generally useful) and allows an individual page to be overwritten. It isn't needed to use the basic logging functionality.

The potential use of this function is that you can save/restore/rewrite three types of data items:

individual strings (must be length 255 which is the default if no length specified)
32-element integer arrays : myarray%(31)
64-element floating point arrays : myarray!(63)

So, if you want to use the code to save/restore individual variables (other than strings) these would need to be copied into arrays.

One of the confusing things is that there are three versions of the code

MX170 SPI
MX170 SPI2 (my implementation)
MX470 SPI2

I could integrate these into a single version but it makes all the CFunctions much bigger so is probably counter-productive.
Back to Top View matherp's Profile Search for other posts by matherp
 
centrex
Guru
Guru
Avatar

Joined: 13 November 2011
Location: Australia
Online Status: Offline
Posts: 320
Posted: 03 June 2016 at 8:38am | IP Logged Quote centrex

Thanks Peter
All work very well on the 28 pin MX170, I don't think they need to be integrated into one.

Only my opinion.

__________________
Cliff
Back to Top View centrex's Profile Search for other posts by centrex Visit centrex's Homepage
 


<< Prev Page of 9 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1719 seconds.
Privacy Policy     Process times : 0.03, 0, 0, 0.14