Cread on 14 bit core


+ Reply to Thread
Results 1 to 10 of 10

Thread: Cread on 14 bit core854 days old

  1. #1
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Cread on 14 bit core

    Is some detectable error condition set if Cread tries to read from a location which has not previously been Cwritten?
    George.

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,756
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.33 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    Cread reads a memory address, If you read back $FF then its pretty certain it was not written to yet. Unless you wanted $FF there..
    Tim

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    Hi Tim, thats OK for 16 bit core but 14 bit uses RETLW and doesn't (return that is).

    I fear I may be looking for the impossible. hey hoo
    George.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,756
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.33 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    Arrr

    I understand now....
    Tim

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,756
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.33 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    What I would consider is that you write a retlw $55 at the end of the code space in your code. Make the call but before make a note of say tmr0. If the Tmr0 value is not as expected for a read then you know you ran through to the end and hit the end stop.
    Tim

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    526
    Thumbs Up
    Received: 60
    Given: 0
    Total Downloaded
    408.14 MB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    Maybe you could try reading the program memory and checking for a RETLW instruction?

    Something like
    Code:
    load address into EEADDRH:EEADDR regs
    EECON1.PGD = 1     'point to program memory
    EECON1.RD = 1      'read it
    NOP                'two cycle stall
    NOP
    result is now in EEDATH:EEDATA regs
    if the upper byte is 'RETLW' instruction( 0x34) it's been initialized
    It would have to be a device that can read its own program memory, and not one of the really basic 14-bit core (ie 16F628)

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    It would have been sensible if Microchip had made RETLW $3F, but I suppose it's a bit late in the day to change it now.

    Thanks Tumbleweed, I'd quite forgotten that the more recent 14 bit devices could read their own program ROM, I'll certainly incorporate that.
    George.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,599
    Thumbs Up
    Received: 341
    Given: 162
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    Move away from the standard 14-bit core devices George.

    They are now, very much, out off date, and even Microchip have quite a few of them in the "legacy" list, which means they are going to drop them soon. If you really need to use 14-bit core devices, go for the enhanced 14-bit core types. They also have fragmented RAM, but have a linear mechanism for indirect RAM and Flash access, that the compiler makes full use of. They also allow writing and reading of the Flash memory itself without paging issues, and with only a few mnemonics, so it makes the code smaller and faster.

    The 18F devices have been around now for about 14 years or so, so they are not new, and are very much easier to use. They are also less expensive than the old devices, and a lot easier to use. The only reason I would use an enhanced 14-bit core device now, is for the ones in the 8-pin package, because, for some unknown reason, Microchip never brought out 18F devices in 8-pin packages, yet the underlying silicon is small enough to fit! But.... That's the stupidity of Microchip, as we've all found out over time. :-)
    Last edited by top204; 2nd February 2018 at 14:10.

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    Move away from the standard 14-bit core devices George
    Is there anyway at compile time to detect if device is 14 bit enhanced? If not, is it possible at run time? Failing that at any time?


    Edit. Already answered this here

    For now I'm going to use _flash=1 or 2 to limit devices and use the test suggested by Tumbleweed.



    Last edited by towlerg; 2nd February 2018 at 15:54.
    George.

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Cread on 14 bit core

    In case anyone passes this way. Thanks again Tumbleweed, for posted code . BTW only works for up to 8k code memory but AFAIK 14 devices that can read flash only go up to 8K.

    This
    Code:
      $if _flash = 0 Or _code < 4096                    
        $error _device " is not a suitable candidate for Snapshot"
      $endif
    and this code
    Code:
      $if _core = 14                                ' test for absence of CData string
        D_AddressEnd = _code - 16
        EEADR = D_AddressEnd.LowByte
        EEADRH = D_AddressEnd.HighByte
        EECON1 = %10000001                          ' read program memory
        Nop                                         ' two cycle stall
        Nop                                         ' EEDATH = 0x3F (erased) or 0x34 (Retlw)      
        
        D_Counter = 16                              ' source ID                                   11 - 24
        While D_Counter > 2
          If EEDATH = 0x34 Then                     ' 
            D_Data = CRead (_code - D_Counter)      ' RETLW found, so do CRead
          Else
            D_Data = 0                              ' no RETLW, so send placeholder
          End If                                     
          GoSub D_SendByteAndUpCRC 
          Dec D_Counter
        Wend
      $elseif _core = 16
        D_Counter = 16                              ' source ID                                   11 - 24
        While D_Counter > 2
          D_Data = CRead (_code - D_Counter) 
          GoSub D_SendByteAndUpCRC 
          Dec D_Counter
        Wend
      $endif
    George.

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Not supported commands for 12-bit core devices
    By basiclover in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 7th August 2018, 17:28
  2. Re: Adin with enhanced 14-bit core devices
    By PA1OKZ in forum Proton Plus Compiler v3
    Replies: 65
    Last Post: 27th October 2012, 12:11
  3. 12 and 14 bit core
    By Oldhack in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 4th October 2012, 17:57
  4. [SOLVED !] 12 BIT core
    By Thanos_of_MW in forum Proton Plus Compiler v3
    Replies: 15
    Last Post: 17th August 2011, 15:31

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts