Same code in different Pins


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Then you would change the PORTL and or PORTH assignments in the .bas file for the chip you are using.

    PORTL and PORTH determine which ports are used for "Pin Numbers".
    PORTL is 0-7
    PORTH is 8-15
    <br>
    Hi Darrel,

    I have looked in the .bas file for the 18F452 and located the following code
    Code:
    PORTL   VAR     PORTB
    PORTH   VAR     PORTC
    TRISL   VAR     TRISB
    TRISH   VAR     TRISC
    Would I be correct in assuming that you also have to "adjust" the TRISL and TRISH aliases as well?

    I take it that the ports dont have to be consecutive so that I could put

    Code:
    PORTL   VAR     PORTB
    PORTH   VAR     PORTD
    TRISL   VAR     TRISB
    TRISH   VAR     TRISD
    Which would give me 0-7 = PortB.0-PortB.7 and 8-15 = PortD.0-PortD.7

    If so that greatly simplifies something I am trying to impliment. The reason I want to change PORTH from C to D is that I need to use the USART which is on C6 and C7 so that would only give me 14 useable pins.


    DOH !!!!

    Thatll teach me not to make sure I have a newly refreshed view of a thread before I post a reply !!!!
    Last edited by keithdoxey; - 27th March 2007 at 20:37. Reason: Explaining why I look like a Dumba$$
    Keith

    www.diyha.co.uk
    www.kat5.tv

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Lightbulb

    I hate when that happens!

    At least everything you said was correct.
    Could have been worse.

    Hey Josuetas,
    Still with us?
    <br>
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default Hi, so many replies in hours!!!

    Thanks Darrel, yes i am here.... i wasnt but now i am....

    Well that is great that at least helps me reduce everything, bad thing is that i already made the PCB, i should get it by thursday... :P

    God thing is i Used Portb(ALL) and PortC(2Bits) and portD (2 bits), and PORTA (4bits) 16 1Wire devices.

    So i Guess by now i will use Darrel`s recomendation for all portb and change the .bas to use portb A, and maybe handle the rest of the bits with select case :'(.

    Darrel by the way.. How then do you use DEFINES to work with your include files? (i dont relly know if yours ), does this mean that once the defined is set one is supposed to stay with it and not change it?

    Thanks to all for your replies, I am still hoping something better could be done

    Bye

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oh good, there you are.
    Sometimes I go off on a tangent when there's no more input to the original question.

    And there's always another way to skin a porcupine. (sorry, but dogs and cats have enough problems right now with the rat poison and all. Time to skin porcupines)

    But since the pins are all scattered across ports, I need some more info.
    Can you list the pins used?
    What data, "Exactly", are you sending. Probably not a string like the example.
    Using 16F or 18F?
    (yes, it's assembly language time)
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Post Assembler Time, i knew it....

    Well this device is some kind of 16 ports 1Wire to Serial HUB, it sends serial
    data to a pc with the info requested by the PC, maybe write the pages of a 1wire device (0-15 pages), read de Identification from a 1Wire, read some temperatures, you should be able to do anything to any device on the port.

    Why?: well in this development I am using up to 16 i-buttons, actually they where read directly through the PC. And i am in Colombia, it is not easy at all to find DS parts, even more it is really expensive.

    What kind of info? well mostly OW commands with data bytes, since each page is 32 bytes it would be interesting to receive and send everything in an array 32 bytes long. Exactly?... well $F0, $cc, some bytes... typical protocol bytes for 1wire

    Pins used: PORTB (ALL), portA (0-3... i hate pin4 ), portC(2,3), portd (0,1)

    Thats all.... its simpler than it seems i guess.... i might do other simple tasks, but i´m sure i dont need help with that.

    I really want to learn this, i m sure you have a great tip behind this request.

    Thanks Again
    Last edited by Josuetas; - 29th March 2007 at 04:54.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Josuetas View Post
    Well this device is some kind of 16 ports 1Wire to Serial HUB, it sends serial
    data to a pc with the info requested by the PC, maybe write the pages of a 1wire device (0-15 pages), read de Identification from a 1Wire, read some temperatures, you should be able to do anything to any device on the port.

    Why?: well in this development I am using up to 16 i-buttons, actually they where read directly through the PC. And i am in Colombia, it is not easy at all to find DS parts, even more it is really expensive.

    What kind of info? well mostly OW commands with data bytes, since each page is 32 bytes it would be interesting to receive and send everything in an array 32 bytes long. Exactly?... well $F0, $cc, some bytes... typical protocol bytes for 1wire

    Pins used: PORTB (ALL), portA (0-3... i hate pin4 ), portC(2,3), portd (0,1)

    Thats all.... its simpler than it seems i guess.... i might do other simple tasks, but i´m sure i dont need help with that.

    I really want to learn this, i m sure you have a great tip behind this request.

    Thanks Again
    How about using a 74138 (3-8 decoder) or 74154 (4-16 decoder), controlled by either 3 or 4 address lines, to apply a ground to the O.W. device desired (thereby powering it up) and using the same one-wire read/write pin in common to all of them? Surely setting porta.0-porta.3 for an address takes a lot less code space than multiple types of OW commands...

    Might not be such a good idea since it'll only save you 3 pins out of your 'Pins used:' list.
    And heck, I don't even know if it'll work...

  7. #7


    Did you find this post helpful? Yes | No

    Lightbulb Seems like an idea but....

    Quote Originally Posted by skimask View Post
    How about using a 74138 (3-8 decoder) or 74154 (4-16 decoder), controlled by either 3 or 4 address lines, to apply a ground to the O.W. device desired (thereby powering it up) and using the same one-wire read/write pin in common to all of them? Surely setting porta.0-porta.3 for an address takes a lot less code space than multiple types of OW commands...

    Might not be such a good idea since it'll only save you 3 pins out of your 'Pins used:' list.
    And heck, I don't even know if it'll work...
    This seems like an idea but it also appeals to me like a waste since i have the micro and i can aviod using more ics.

    What is really interesting and almost a need is to discuss if it is posible to use several OW devices conected to the same wire with the OWOUT OWIN commands, i havent really got into the subject but.... how do you assign addreses(ids) to each device conected to the line? I would have to read the document about the OW protocol by maxim, it dont seems to be simple at all.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Josuetas View Post
    I really want to learn this, i m sure you have a great tip behind this request.
    Well of course I do.
    And it's a scary one. Yet oh so cool.

    But to make it work, I still need to know...

    16F or 18F ?
    <br>
    DT

  9. #9
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Talking

    Quote Originally Posted by Darrel Taylor View Post
    And there's always another way to skin a porcupine. (sorry, but dogs and cats have enough problems right now with the rat poison and all. Time to skin porcupines)
    Naw, porcupines need love too . . . let's skin Bureaucrats, nobody loves them . . . anyway this post gets filed into my bookmarks
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  10. #10
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Joe,

    Ok, but you can Hug the porcupines.
    Unfortunately, the Bureaucrats have already made sure it's illegal to skin them.
    And they're usually followed by bodyguards.

    Josuetas,

    I know things are slow in Columbia, but come on, get with the program.
    Simple question.
    16F or 18F ?????
    <br>
    DT

  11. #11


    Did you find this post helpful? Yes | No

    Exclamation Not That slow...

    Hello, i am back from a small holiday.

    Well i guess 16f877 is a solid choice.

    I have been working in the code already, will post if something is wrong, but by now i guess everything is quite simple.

    Anyway, i guess that if i really intend to find something new here, it would be interesting to discuss both 16 and 18 options, maybe for some other project the 18F would be required.

    I promise to stay more tuned to this thread now

    by the Way is not Columbia, i am in Colombia . And things arent THAT slow here....

Similar Threads

  1. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 20:52
  2. Nokia COLOR LCD PicBasicPro 2.50a example code
    By skimask in forum Code Examples
    Replies: 49
    Last Post: - 28th September 2011, 01:43
  3. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  4. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

Members who have read this thread : 0

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