MID$ Problem with a PIC18F25K22


Today 15:54
Forum: GPS
Starter: SimonJA
Views: 0
Replies: 14
Today 15:17
Forum: Proton Plus Compiler v3
Starter: Les
Views: 0
Replies: 15
Go to last post By: tumbleweed
Today 14:37
Forum: The Lounge
Starter: towlerg
Views: 0
Replies: 1
Go to last post By: fanie
Today 14:10
Forum: The Lounge
Starter: John Drew
Views: 0
Replies: 12
Today 12:55
Forum: The Lounge
Starter: fanie
Views: 0
Replies: 18
Today 02:12
Forum: The Lounge
Starter: towlerg
Views: 0
Replies: 5
Today 01:13
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 25
Yesterday 19:17
Forum: The Lounge
Starter: basparky
Views: 0
Replies: 14
Go to last post By: mjturner
Yesterday 18:24
Forum: The Lounge
Starter: mjturner
Views: 0
Replies: 3
+ Reply to Thread
Results 1 to 3 of 3

Thread: MID$ Problem with a PIC18F25K2294 days old

  1. #1
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    1 Not allowed!

    Question MID$ Problem with a PIC18F25K22

    Hi everybody, I encounter a strange problem : I have a string of 230 characters. This string is divided into 10 segments of 23 characters, with a blank between each segment. I use a uOLED 4DSYSTEM display (uOLED 160G2) to display on each of 6 lines (4,6,8,10,12,14) a different segment of 23 characters. Here is the part of interest of my listing.

    Declare Xtal 64 : OSCCON = $F0 : OSCTUNE = $40 ;horloge interne 64MHz
    TRISB = $00 : TRISC = $20
    Symbol OLED = PORTC.4 : Symbol timetemp = PORTC.5


    Dim i As Byte : Dim numeromp3 As Byte : Dim numtrain As Byte : Dim numtrainajust As Byte : Dim numligne As Byte : Dim numligneajust As Byte

    Dim trains10 As String * 239

    trains10 = "xxxxxxxxxxxxxxxxxxxxxxx ....." ;(239 characters)

    debut:

    For numligne = 0 To 5

    numligneajust = numligne * 2 + 4
    numtrainajust = numligne * 23 + 1

    SerOut OLED,84,[$FF,$E4,$00,numligneajust,$00,$00] : DelayMS 50 ;adress of the line to display the segment n on the OLED

    SerOut OLED,84,[$00,$06,Mid$(trains10,numtrainajust,23),$00] : DelayMS 50 ;string to display on line defined

    Next numligne

    goto debut


    The problem is with the use of the variable "numtrainajust" (beginning of the segment). It's not running, but if I replace "numtrainajust" by a constant, I display the same segment (of course) on all of my six lines.

    So I don't understand why I cannot use a variable instead of a constant. I don't find where is my mistake.

    Thanks for your help !

  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
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    418
    Thumbs Up
    Received: 29
    Given: 6
    Total Downloaded
    2.11 GB

    0 Not allowed!

    Default Re: MID$ Problem with a PIC18F25K22

    By "not running" do you meant not at all, it does nothing, or that it does something but not do what you want it to do.

    I assume you want to multiple numligneajust by 23, then add 4 to it and to multiply numtrainajust by 23 then add 1 to it, if so then what happens if you change you calculations to...
    numligneajust = (numbligne *2) + 4
    numtrianajust = (numbligne * 23) +1

    thereby ensuring the correct precedence in the calculation.

  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
    Junior Member palamont's Avatar
    Join Date
    Dec 2016
    Posts
    10
    Thumbs Up
    Received: 2
    Given: 0
    Total Downloaded
    73.44 MB

    0 Not allowed!

    Default Re: MID$ Problem with a PIC18F25K22

    Hi Stephen, thanks for your answer, and sorry for my english. You have exactly described what I wanted to do. By "not running", I wanted to say that I had nothing on my display. But, if I replace variables by constants, all is OK. And also, if I do the mathematical operations out of the "SerOut" command, all is OK. That's would want to say it's not possible to insert a math expression inside the "SerOut". So it's the solution I apply. Thanks for your help.

  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.

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. Mid$ not recognised
    By John Drew in forum Proton Plus Compiler v3
    Replies: 15
    Last Post: 21st March 2018, 09:58
  2. Issue with MID$
    By Frizie in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 23rd September 2017, 12:59
  3. Problem with MID$ - need help
    By xldaedalus in forum Proton Plus Compiler v3
    Replies: 5
    Last Post: 9th August 2016, 22:28
  4. Pic18F25K22 - PortB enabling Pull up
    By sachindev986 in forum Interrupt Sources
    Replies: 8
    Last Post: 14th June 2014, 21:54
  5. Pic18F25K22 or Pic18F24K22 QFN
    By Tim in forum The Lounge
    Replies: 6
    Last Post: 11th October 2010, 07:29

Members who have read this thread since 1st January 2019, 10:39 : 0

Actions :  (Set Date)  (Clear Date)

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

Posting Permissions

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