Go to last post By: John Drew
Today 12:03
Forum: The Lounge
Starter: charliecoultas
Views: 0
Replies: 7
+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Mid$ not recognised35 days old

  1. #1
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,961
    Thumbs Up
    Received: 94
    Given: 28
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Mid$ not recognised

    The Proton compiler supports String variables, only when targeting an 18F or enhanced 14-bit
    core device.
    I'm trying to use Mid$ on a string using the 16F1827 which is an enhanced device. The compiler doesn't recognise the MID$.
    The compiler does recognise that I'm using an enhanced device and didn't object to me declaring strings and bringing them in from a GPS.

    Has anyone else encountered non recognition of MID$ and is there a workaround? I'll try other string functions and check if they are also not recognised.
    John

    PS it doesn't recognise Left$ or Right$ either but it will copy strings.
    Last edited by John Drew; 18th March 2018 at 05:18. Reason: added ps

  2. #2
    Member Henk57's Avatar
    Join Date
    Jan 2014
    Posts
    282
    Thumbs Up
    Received: 20
    Given: 24
    Total Downloaded
    192.60 MB

    0 Not allowed!

    Default Re: Mid$ not recognised

    I'm not suprised, I had problems with the 16F1829 fRound command.
    So I had to choose for ie. 18F26K22.

    Why they never change 16F182x to 18F182x family??

  3. #3
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,961
    Thumbs Up
    Received: 94
    Given: 28
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Mid$ not recognised

    I've had to compromise with some workarounds. Microchip doesn't make things easy.
    I think I'll have to search for an 18F with 18 pins that has compatible pins to the 16F1827. Board is made.
    John

  4. #4
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,543
    Thumbs Up
    Received: 100
    Given: 136
    Total Downloaded
    2.40 GB

    0 Not allowed!

    Default Re: Mid$ not recognised

    According to MAPS (which isn't quite so painful if you run it offline) you have only 4 choices 18F1220, 18F1230, 18F1320 AND 18F1330. No guarantees that they are compatible though, just the right pin count.

    Doesn't look great. Less Ram, half the EEPROM, no hardware SPI OR I2C but faster and a bit more ROM.

    If it's only a one off, could you make a daughter board and use a more appropriate device?

    Image.jpg
    Last edited by towlerg; 18th March 2018 at 13:28.
    George

  5. #5
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,543
    Thumbs Up
    Received: 100
    Given: 136
    Total Downloaded
    2.40 GB

    0 Not allowed!

    Default Re: Mid$ not recognised

    Thats odd, just out of curiosity I tried one of the MID$ examples with 16F1827

    Code:
      Device = 16F1827                     ' A suitable device for Strings
    
      Dim SourceString As String * 20 ' Create a String of 20 characters
      Dim DestString As String * 20 ' Create another String
      SourceString = "Hello World" ' Load the source string with characters
    
      DestString = Mid$(SourceString, 4, 5)
      Stop
    It compiles and the sim gives the correct result.

    My 16F1827.DEF starts
    Code:
    ' Always make a backup of this file if modifications are carried out.
    ' Modifications to this file may affect the performance of the compiler
    '
    ' Device 16F1827
    ' File Author Les Johnson.
    ' Creation Date 02/10/2016
    '
    $ifndef _16F1827_
    $define _16F1827_
    
    ' Device Information
    $define _device _16F1827
    $define _core 14
    $define _ecore 1     ' Enhanced 14-bit core
    George

  6. #6
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,961
    Thumbs Up
    Received: 94
    Given: 28
    Total Downloaded
    1.39 GB

    0 Not allowed!

    Default Re: Mid$ not recognised

    Thanks George
    The devices you found are all available at reasonable prices. So that's a good backup.
    That is odd, the compiler reported that it didn't recognise any of the string splitters.
    I wonder if I defined the string as an array not a string. I'll check later today.
    Unfortunately I only have the demo ISIS and the board isn't set up for ICSP so the socket is getting a workout.
    John

  7. #7
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,543
    Thumbs Up
    Received: 100
    Given: 136
    Total Downloaded
    2.40 GB

    1 Not allowed!

    Default Re: Mid$ not recognised

    Shame in you John, dont you know to include a ICSP socket, so you never need it and all your code runs first time.

    If your code is in anyway complex it might mbe worth you while building a daughter board with an ICSP socket and pin for pin for everything else?

  8. #8
    Administrator John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,961
    Thumbs Up
    Received: 94
    Given: 28
    Total Downloaded
    1.39 GB

    1 Not allowed!

    Default Re: Mid$ not recognised

    I know, not good enough.
    The gadget I'm working on is the "GPS based frequency reference" described in the Silicon Chip magazine of March/April 2007 and updated in September 2011 and October 2017.
    The provided hex file was for a 4800 baud connection. My friend's GPS provided 9600 baud and despite receiving an update from the author the latter didn't work. So I'm making a fresh start using Proton.
    The commercial board uses a 16F628A but I thought I could improve things by making use of an enhanced chip - hence the issue.
    Anyway to cut a long story shorter (!) I've used some array slicing simulating the MID$ function with the 16F628A and I have it working.
    I will go back to the 16F1827 as I see I defined the supposed string as an array which is probably the cause of the MID$ problem and I want to prove myself an idiot in the declaration and MID$ does work after all.
    Oh well, it's been raining and so I can't cut the lawns after all, what a shame, now I'll have to spend time in my ham shack..
    Cheers
    John

  9. #9
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,131
    Thumbs Up
    Received: 53
    Given: 35
    Total Downloaded
    1.72 GB

    1 Not allowed!

    Default Re: Mid$ not recognised

    George

    The Aussies are as good at getting software to work first time as they are at cricket, at the moment.

    The real purpose of this post is to ask if you have noticed that "some" GPS modules report a time that is a few seconds fast but then, after a few minutes, report the correct seconds value. I have discovered this by having two GPS modules driving two clocks. If I restart the "B" clock, it always gets GPS lock (a "A" response") but its "seconds" count is 2 or 3 ahead of actual time.

    Charlie

  10. #10
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    1,543
    Thumbs Up
    Received: 100
    Given: 136
    Total Downloaded
    2.40 GB

    0 Not allowed!

    Default Re: Mid$ not recognised

    I know nothing of the Intricacies of GPS but I suspect your answer may be in the definition of "GPS lock".
    George

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. New Key is not recognised
    By crankshaft in forum USB License key
    Replies: 7
    Last Post: 2nd October 2017, 06:04
  2. USB Device not Recognised
    By Dave-S in forum USB
    Replies: 14
    Last Post: 15th June 2017, 18:47
  3. Problem with MID$ - need help
    By xldaedalus in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 9th August 2016, 22:28
  4. CCP1CON not recognised for 18F2620
    By jonnykyoto in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 29th May 2006, 15:27

Members who have read this thread since 14th April 2018, 14:51 : 2

Actions :  (Set Date)  (Clear Date)

You do not have permission to view the list of names.

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