Is it possible to alias the SerOut pin


+ Reply to Thread
Results 1 to 6 of 6

Thread: Is it possible to alias the SerOut pin42 days old

  1. #1
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,374
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Is it possible to alias the SerOut pin

    Hi,
    As the title says, is it possible to alias the pin used for "SerOut"?, I would like to send a string out on each pin of a port so PortB.0 first and sequentially through to PortB.7 and then loop again.
    I know I could do this long hand but it would be a lot neater if it was possible to have something like

    For LoopCtr = 0 To 7
    SerOut PORTB.LoopCtr,T2400,[Dec LoopCtr,10,13]
    Next LoopCtr

    Regards,
    Bob

  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,816
    Thumbs Up
    Received: 52
    Given: 96
    Total Downloaded
    1.33 GB

    0 Not allowed!

    Default Re: Is it possible to alias the SerOut pin

    Bob

    Not as far as I know. What you can do is write the data to a string then call a send routine in a loop passing a number that selects the appropriate line with the SerOut PortX.X String
    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
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,671
    Thumbs Up
    Received: 353
    Given: 168
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Proton Compiler: Pin Number Aliasing to a Variable

    There is a mechanism in the Proton and Proton24 compilers that allows a variable or constant value to hold the pin used by a command. I added it a few years ago, but have refined it for the Positron boards and it is in the latest compiler version.

    There is reference to the mechanism in the compiler's manual for Input, Output, SetPin, ClearPin etc, and I'll add it to the standard commands in a later version for the Positron boards.

    Here's an example to show it working:
    Code:
    '
    '   /\\\\\\\\\
    '  /\\\///////\\\
    '  \/\\\     \/\\\                                                 /\\\          /\\\
    '   \/\\\\\\\\\\\/        /\\\\\     /\\\\\\\\\\     /\\\\\\\\   /\\\\\\\\\\\  /\\\\\\\\\\\  /\\\\\\\\\
    '    \/\\\//////\\\      /\\\///\\\  \/\\\//////    /\\\/////\\\ \////\\\////  \////\\\////  \////////\\\
    '     \/\\\    \//\\\    /\\\  \//\\\ \/\\\\\\\\\\  /\\\\\\\\\\\     \/\\\         \/\\\        /\\\\\\\\\\
    '      \/\\\     \//\\\  \//\\\  /\\\  \////////\\\ \//\\///////      \/\\\ /\\     \/\\\ /\\   /\\\/////\\\
    '       \/\\\      \//\\\  \///\\\\\/    /\\\\\\\\\\  \//\\\\\\\\\\    \//\\\\\      \//\\\\\   \//\\\\\\\\/\\
    '        \///        \///     \/////     \//////////    \//////////      \/////        \/////     \////////\//
    '                                  Let's find out together what makes a PIC Tick!
    '
    ' Demonstration for the use of a variable to choose the pin used for Serout
    ' Written by Les Johnson for the Proton BASIC Compiler
    '
        Device = 18F25K20 
        Declare Xtal = 16
    
        Dim Serial_Pin As Byte                                      ' Holds the pin to use for Serout
     
        Do                                                          ' Create a loop
            For Serial_Pin = Pin_C0 To Pin_C2                       ' Create a loop to change the serial pin used
                SerOut Serial_Pin, 84, ["Pin: ", Dec Serial_Pin,_   ' Transmit from each pin chosen at 9600 Baud
                                        ": Hello World", 13]
            Next 
            DelayMS 200                                             ' A small delay between transmissions
        Loop                                                        ' Do it forever
    The references to the Pin_xx constants can be found in each device's .def file (at the very bottom of the file)

    And here is the above program working in Isis. Notice that each serial terminal is connected to a seperate pin.

    Click image for larger version

Name:	Serout_MultiPin.jpg
Views:	48
Size:	89.1 KB
ID:	3958
    Last edited by top204; 1st June 2020 at 11:43.

  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 RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,374
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Re: Is it possible to alias the SerOut pin

    Hi Les,
    That is exactly what I am trying to do, I notice you have put pull up resistors in the sim. I never do but is that something I will need to do in real hardware, I think I may have a problem if I do.

    The end plan is a cable core tracer where you connect up to 8 cores to the port and at the other end you connect the device to any 2 pins and it will show the corresponding number it is connected to. It does not require any known ground connection as such as it uses the other 7 pins as the ground as they are turned to inputs when not sending as it steps through the sequence.
    Well, that is the theory anyway.

    Regards,
    Bob

  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 top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,671
    Thumbs Up
    Received: 353
    Given: 168
    Total Downloaded
    1.99 GB

    0 Not allowed!

    Default Proton BASIC: Pull-Up resistor on USART RX line

    In async coms, it is always advisable to place a pull-up resistor on the RX line, otherwise it is floating and will detect transmissions when there are none. It will also screw up any timeouts that are awaiting transmissions because it will see random ghost transmissions from the floating input pin. I've done this for many years now, and I've created circuits by mistake that did not have the pull-up resistor and the microcontroller went beserk because it was constantly receiving ghost bytes. If using a serial interrupt buffer, it is essential, otherwise the interrupt will continuosly be triggered with the ghost receptions and the program will slow down dreadfully with the interrupt constantly firing and the buffer filling with rubbish and missing the actual data sent to it. :-)

    The pull-up resistor can be a very high resistance, for example 150K to 180K etc... And it just helps to stop the RX line floating but does not put a load onto it that will stop lows getting through. It also helps to signify a start of transmission because that will be a change of state on the pin.

    If using inverted async coms, then it is a Pull-Down resistor.

    Bottom line is.... "Never leave an input pin floating". However, if you always have a tranmitter connected to the RX line, then it may act as the pull-up itself, but it can never be guaranteed because some devices go open-drain or open-source when transmission is ended.

    For your Serout command with different pins question:

    For multiple pin use, you could always use the hardware USART commands on certain devices, and change their pins with PPS (Peripheral Pin Select) before they are called in the program.
    Last edited by top204; 1st June 2020 at 14:44.

  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 RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,374
    Thumbs Up
    Received: 29
    Given: 7
    Total Downloaded
    1.16 GB

    0 Not allowed!

    Default Re: Is it possible to alias the SerOut pin

    Hi Les,
    Thanks for the info, I have amended my VSM and I do not get any garbage on the first line now.

    Interesting thought regards the PPS but I am trying to use up parts I already have, it could be a good project to try Proton24 when I get it sorted on the 8 bit device and could have 16 pins or more.

    Regards,
    Bob

  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.

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. How to connect LCD1602 data pin to random pin MCU?
    By Alexander in forum Proton Plus Compiler v3
    Replies: 20
    Last Post: 2nd April 2017, 09:54
  2. [SOLVED !] PIC 18 pin and 8 pin development board for sale
    By Koenig in forum Wanted and For Sale
    Replies: 0
    Last Post: 10th August 2011, 14:04
  3. [SOLVED !] Peripheral Pin Select (PPS)..... Pin Remapping?
    By BenH in forum Proton Plus Compiler v3
    Replies: 3
    Last Post: 5th October 2010, 14:39
  4. Edata alias
    By bcans in forum Proton Plus Compiler v3
    Replies: 22
    Last Post: 19th May 2009, 06:41
  5. 8 pin SOIC to 8 pin DIL adapter
    By BrianPS in forum Wanted and For Sale
    Replies: 2
    Last Post: 20th November 2004, 01:37

Posting Permissions

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