Problem with ports help plz


Closed Thread
Results 1 to 34 of 34

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Hello Mus.me,
    Please tell us which PIC you are using, as each is a little different, so WE may look into it's data sheet. Your code looks like it will work BUT the unknown is if your PIC has analog stuff on portB, which you have not disabled.
    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.

  2. #2
    Join Date
    May 2009
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hello Mus.me,
    Please tell us which PIC you are using, as each is a little different, so WE may look into it's data sheet. Your code looks like it will work BUT the unknown is if your PIC has analog stuff on portB, which you have not disabled.
    THANKS JOE ,IM USING F84 NOW I CHANGED SOME WIRES IT WORKS, BUT IM STILL FIGHTING WITH VARIABLES ,

    THIS CODE IT WORKS
    DEFINE OSC 4
    TRISB = 0
    PORTB = 0
    J VAR PORTB.5
    Main:
    PORTB.6 = 1
    PORTB = %00100001 '
    PAUSE 1
    J =0
    PORTB = %00111010 '
    PAUSE 1
    J = 0
    PORTB = %00100001 ' LETTER A
    PAUSE 1
    J = 0
    PORTB = %00111111 'SPACE
    PAUSE 1
    J = 0
    PORTB = %00100001 '
    PAUSE 1
    J =0
    PORTB = %00111010 '
    PAUSE 1
    J = 0
    PORTB = %00100001 'LETTER A
    PAUSE 1
    J = 0
    PORTB = %00111111 ' SPACE
    PAUSE 1
    J = 0
    PORTB = %00110101 ' DOTS :
    PAUSE 1

    GOTO Main

    END

    I WANT TO USE VARIABLES
    EXAMPLE


    DEFINE OSC 4
    TRISB = 0
    PORTB = 0
    J VAR PORTB.5
    A VAR BYTE
    B VAR BYTE
    C VAR BYTE
    D VAR BYTE
    E VAR BYTE
    F VAR BYTE
    G VAR BYTE
    H VAR BYTE
    I VAR BYTE
    Main:
    PORTB.6 = 1
    PORTB = A
    PAUSE 1
    J =0
    PORTB = B
    PAUSE 1
    J = 0
    PORTB = C
    PAUSE 1
    J = 0
    PORTB = D
    PAUSE 1
    J = 0
    PORTB = E
    PAUSE 1
    J =0
    PORTB = F
    PAUSE 1
    J = 0
    PORTB = G
    PAUSE 1
    J = 0
    PORTB = H
    PAUSE 1
    J = 0
    PORTB = I
    PAUSE 1

    GOTO Main

    END
    or like this

    DEFINE OSC 4
    TRISB = 0
    PORTB = 0
    TXT VAR BYTE
    K VAR BYTE
    J VAR PORTB
    PORTA = 1
    TRISA = 1

    LOOP:
    'IF PORTA.4 = 0 THEN GOTO MAIN
    'LOOKUP K,[],TXT
    FOR TXT = 1 TO 10
    READ TXT,K
    J = K
    PAUSE 1
    NEXT TXT
    GOTO LOOP
    END
    DATA @ 1,%01101011,%01010101,%01101011_
    ,%01010101,%01101011,%01010101,%01101011_
    ,%01010101,%01101011,1


    i've done PORTB.1 to 05 outputs to LEDs anoides , and ic 4017 to 9 cathodes and PORTB.0 pulse to 4017 clock and PORTB.7 to 4017 reset, i hope u understand and tell me ur ideas about the variables thanks.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    PORTB = %00100001 ' LETTER A
    no good when you later have
    PORTB = A

    Try....
    Code:
    A VAR BYTE
    A =   %00100001
    PORTB = A
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    May 2009
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    portb = %00100001 ' letter a
    no good when you later have
    portb = a

    try....
    Code:
    a var byte
    a =   %00100001
    portb = a
    sorry i didnt explaine good my code
    example the letter a is this

    portb = %00100001 'letter a 1/3
    pause 1
    j =0
    portb = %00111010 '" 2/3

    pause 1
    j = 0
    portb = %00100001 ' " 3/3
    pause 1
    j = 0

    each letter has 3 lines of 5 leds

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


    Did you find this post helpful? Yes | No

    Default

    Hi Mus.Me,
    2 things,
    <b>first </b>Use Code Tags, Please.
    You do this by writing the word" code "in between square brackets[write it here ] before your code, and after your code you put /code again in between square brackets, like so [/code]
    <b>second</b> thing, what was the PIC you were having trouble with before?
    Look at these links:
    http://www.picbasic.co.uk/forum/showthread.php?t=11263
    http://www.picbasic.co.uk/forum/showthread.php?t=10834
    16F84 is a good fit for you right now, no extra distractions, "fighting with variables"? Oh, I see what you are saying . . .
    Last edited by Archangel; - 28th July 2009 at 04:05.
    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.

  6. #6
    Join Date
    May 2009
    Posts
    66


    Did you find this post helpful? Yes | No

    Default

    Code:
    thank u joe for help i will do it right this time lol
    Last edited by Mus.me; - 29th July 2009 at 05:07.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Mus.me View Post
    Code:
    thank u joe for help i will do it right this time lol
    Great ! How's that code coming ?
    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.

Similar Threads

  1. sleep problem help plz >>>.
    By Mus.me in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 16th November 2009, 08:21
  2. Replies: 6
    Last Post: - 10th January 2008, 10:38
  3. ESC problem plz help
    By al000y in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 21st January 2007, 10:21
  4. Problem reading multiple ADC ports
    By jswayze in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 4th November 2004, 16:46
  5. Problem with intensity.. plz help
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th October 2004, 17:25

Members who have read this thread : 1

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