[SOLVED !] Using modifiers in an array.


Closed Thread
Results 1 to 10 of 10

Thread: Using modifiers in an array.2038 days old

  1. #1
    Maxim
    Guest Maxim's Avatar

    0 Not allowed!

    Default Using modifiers in an array.

    In pic basic pro you can use the ARRAYWRITE command which allows you to use HEX BIN and DEC modifiers. As far as I can tell you can only use HEX BIN and DEC modifiers with PRINT an SERIAL commands. So does anyone know of a work around to do this.

    Thanks Maxim.

  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
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,400
    Thumbs Up
    Received: 80
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: Using modifiers in an array.

    Which commands other than PRINT and SERIAL would you like to use the modifiers with?

    Norm

  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
    Maxim
    Guest Maxim's Avatar

    0 Not allowed!

    Default Re: Using modifiers in an array.

    I would like to modify an array, so I could change any part of it to be anything I wanted it to be on the fly, then display it or send it. I know I can write my own code to do this, but it would save a lot of time to just use the built in modifiers.

    Thanks Maxim.

  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
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,400
    Thumbs Up
    Received: 80
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: Using modifiers in an array.

    Quote Originally Posted by Maxim View Post
    I would like to modify an array, so I could change any part of it to be anything I wanted it to be on the fly, then display it or send it. I know I can write my own code to do this, but it would save a lot of time to just use the built in modifiers.

    Thanks Maxim.
    Something like this?

    Norm
    Code:
    'Compiler version 3.5.6.9
    'Compile in ISIS
    
      Device = 18F452
    
      Config_Start
        OSC = XT	;XT oscillator
        OSCS = OFF	;Oscillator system clock switch option is disabled (main oscillator is source)
        PWRT = OFF	;PWRT disabled
        BOR = On	;Brown-out Reset enabled
        BORV = 27	;VBOR set to 2.7V
        WDT = OFF	;WDT disabled (control is placed on the SWDTEN bit)
        WDTPS = 128	;1:128
        CCP2MUX = OFF	;CCP2 input/output is multiplexed with RB3
        STVR = OFF	;Stack Full/Underflow will not cause RESET
        LVP = OFF	;Low Voltage ICSP disabled
        Debug = OFF	;Background Debugger disabled. RB6 and RB7 configured as general purpose I/O pins.
        Cp0 = OFF	;Block 0 (000200-001FFFh) not code protected
        CP1 = OFF	;Block 1 (002000-003FFFh) not code protected
        CP2 = OFF	;Block 2 (004000-005FFFh) not code protected
        CP3 = OFF	;Block 3 (006000-007FFFh) not code protected
        CPB = OFF	;Boot Block (000000-0001FFh) not code protected
        CPD = OFF	;Data EEPROM not code protected
        WRT0 = OFF	;Block 0 (000200-001FFFh) not write protected
        WRT1 = OFF	;Block 1 (002000-003FFFh) not write protected
        WRT2 = OFF	;Block 2 (004000-005FFFh) not write protected
        WRT3 = OFF	;Block 3 (006000-007FFFh) not write protected
        WRTC = OFF	;Configuration registers (300000-3000FFh) not write protected
        WRTB = OFF	;Boot Block (000000-0001FFh) not write protected
        WRTD = OFF	;Data EEPROM not write protected
        EBTR0 = OFF	;Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks
        EBTR1 = OFF	;Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks
        EBTR2 = OFF	;Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks
        EBTR3 = OFF	;Block 3 (006000-007FFFh) not protected from Table Reads executed in other blocks
        EBTRB = OFF	;Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks
      Config_End
    
      Declare Hserial_Baud = 9600
      Declare Hserial_RCSTA = %10010000
      Declare Hserial_TXSTA = %00100100
      Declare Hserial_Clear = On
    
      Xtal = 4
    
      Clear
      Dim array[20] As Word
      Dim i As Byte
    
    'LOAD ARRAY
      i = 0
      While i < 20
        array[i] = i 
        Inc i
      Wend
    
    'MODIFY ARRAY
      array[2] = 200
    
    'DISPLAY ARRAY
      i = 0
      While i < 20
        HSerOut[" ",Dec array[i],13]
        HSerOut["$",Hex array[i],13]
        HSerOut["%",Bin array[i],13]
        HSerOut[" ",13]
        Inc i
      Wend
    
      Stop
      End

  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
    Maxim
    Guest Maxim's Avatar

    0 Not allowed!

    Default Re: Using modifiers in an array.

    I was thinking more of:

    Dim array[20] as byte

    array = "time", Dec2 Hour, Dec2 Min, Dec2 Sec: gosub Dataout
    array = "date", Dec2 Day, Dec2 Month,"Cal" : gosub Dataout

    Dataout:
    hserout [str array\20]
    print str array\20
    return

    Maxim

  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
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,400
    Thumbs Up
    Received: 80
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: Using modifiers in an array.

    Quote Originally Posted by Maxim View Post
    I was thinking more of:

    Dim array[20] as byte

    array = "time", Dec2 Hour, Dec2 Min, Dec2 Sec: gosub Dataout
    array = "date", Dec2 Day, Dec2 Month,"Cal" : gosub Dataout

    Dataout:
    hserout [str array\20]
    print str array\20
    return

    Maxim
    From what I can see PDS requires the formatting of array byte hour to display 01 for example to be done in HSerOut as you originally posted.
    You also could store the formatted data in individual strings.
    Note there are "strings" and "array of bytes of ASCII" but no "arrays of strings".

    Hope this helps.
    Norm

  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
    Maxim
    Guest Maxim's Avatar

    0 Not allowed!

    Default Re: Using modifiers in an array.

    Thanks for the info but I guess I will have to do it my way unless les has got 5 minuets spare to add it to proton.

    Thanks Maxim.

  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,584
    Thumbs Up
    Received: 337
    Given: 161
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Using modifiers in an array.

    5 minutes to add that sort of functionality to a standard 14-bit core device!!!!! Seriously?

    For that type of formatting (but a different syntax) , Strings are more suitable which will require either an enhanced 14-bit core device, an 18F device, a PIC24 device, or a dsPIC33 device.

  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
    Maxim
    Guest Maxim's Avatar

    0 Not allowed!

    Default Re: Using modifiers in an array.

    Ok Les I will give you 6 minutes and no more.

    Thanks Maxim

  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
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,584
    Thumbs Up
    Received: 337
    Given: 161
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Re: Using modifiers in an array.

    Maybe 20 mins.

    For more advanced string manipulations, standard 14-bit core devices are not the right solution because of their fragmented RAM and very clumsy indirect access mechanism. If a 14-bit core device is a must, then consider the enhanced types. At least they have less fragmented RAM, but still fragmented, and a half decent indirect access mechanism.

    For true linear RAM with no bank selections, and an excellent indirect access mechanism, consider a PIC24 or dsPIC device.
    Last edited by top204; 3rd November 2014 at 21:22.

  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. Replies: 2
    Last Post: 17th January 2019, 16:49
  2. Send array using HRSOUT with the "Str array\n" option
    By towlerg in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 26th September 2016, 18:57
  3. Array
    By SimonGie in forum Proton Plus Compiler v3
    Replies: 12
    Last Post: 12th November 2009, 09:48
  4. Serial Input Modifiers
    By jracomp in forum Proton Plus Compiler v3
    Replies: 8
    Last Post: 25th November 2004, 16:42

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