Serin serout problem - Page 9


Closed Thread
Page 9 of 9 FirstFirst ... 56789
Results 321 to 337 of 337
  1. #321
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Huh?

    Quote Originally Posted by mister_e View Post
    Joe S. ... i'm a bit disapointed
    what did I do?
    Edit:
    Ohhh I see, I missed his using a goto instead of gosub.
    You know why I missed this, because I never tried to run his code in hardware, so I never copied it to PBP compiler. I got lazy. Sorry
    Last edited by Archangel; - 5th February 2007 at 02:42.
    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. #322
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Oh i don't think you got lazy... after maybe over 100 reply in this 63 pages and 322 replies thread (feb 05, 2007).

    It was more about kidding you a little bit
    Last edited by mister_e; - 5th February 2007 at 07:36.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default Seeing eye glasses

    Quote Originally Posted by mister_e View Post
    Oh i don't think you got lazy... after maybe over 100 reply in this 63 pages and 322 replies thread (feb 05, 2007).

    It was more about kidding you a little bit
    I really got to get me some new computer glasses, my 15' LCD @ 1024 x 768 makes this forum really hard to see, the compiler has larger fonts and brighter text. Someday a 42" monitor. Seriously mister_e I think I don't miss too much considering the first thing I programmed was in july, and all my teachers are here.
    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.

  4. #324
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yeah i know, seems you learn fast as well. Don't give up!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #325
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    HI,

    how the heck do you disable portE.2 on a pic16F877a. I would like to use it as a serin pin. I would like to disable the parallel slave port, and make use of the serin command. The serin command works for portB fine.
    thanks

  6. #326
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    HI,

    how the heck do you disable portE.2 on a pic16F877a. I would like to use it as a serin pin. I would like to disable the parallel slave port, and make use of the serin command. The serin command works for portB fine.
    thanks
    What do you mean disable portE.2?
    If you're talking about disabling the whole parallel slave port (driven using Port D), then set TRISE.4 = 0 (it's in the datasheet, Section 4.5, Page 50 I think).


    P.S. Are we going for some sort of record on this thread? Because it's covered a LOT of subjects so far (wireless, A/D, I2C, math, etc.etc).

  7. #327
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    well basically I use this command:
    serin portB.2 = works
    serin portE.2 = do not work

    I set them both as input.
    All my B ports are taken up already.

  8. #328
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    well basically I use this command:
    serin portB.2 = works
    serin portE.2 = do not work

    I set them both as input.
    All my B ports are taken up already.
    It's not set up as an analog port is it?
    Maybe you set TRISE as $FF instead of %00000111. If you did, bit 4 will change Port E into control for the PBP.
    But, again, I'm probably pointing out the obvious to you...
    Have you tried just setting the pin high and low and reading it and seeing what happens?

  9. #329
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Well here is the program that works:
    but changing portb.2 to porte.2
    it do not work.


    INCLUDE "modedefs.bas"
    @ DEVICE PIC16F877a , HS_OSC , WDT_OFF , PWRT_ON , BOD_ON , LVP_OFF , PROTECT_OFF
    'HS 20mhz, watchdog off, powerup timer on, mclr external, brown out detect on, low volt program off , code protect off

    DEFINE OSC 20 'use external 20mhz crystal

    DEFINE LCD_DREG PORTD ' Set LCD Data port
    DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
    DEFINE LCD_RSBIT 6 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTC ' Set LCD Enable port
    DEFINE LCD_EBIT 7 ' Set LCD Enable bit ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2500
    DEFINE LCD_DATAUS 250
    DEFINE CHAR_PACING 2000

    Pause 2000 ' Wait 2 second

    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %00111111
    TRISC = %00010000
    TRISD = %00000000
    TRISE = %00000111

    right var byte : left var byte
    temp var word : counter var byte
    rightold var word : leftold var word : speedright var byte : speedleft var byte

    '************************************************* ***************************************
    loop:

    portb.7 =1
    pause 100
    portb.6 =1
    pause 100

    waitfor55:
    serin portb.2 , n2400 , temp : if temp <> $55 then goto waitfor55
    waitforaa:
    serin portb.2 , n2400 , temp : if temp <> $aa then goto waitforaa

    serin portb.2, n2400, rightold.LowBYTE : serin portb.2, n2400, rightold.HighBYTE
    serin portb.2, n2400, leftold.LowBYTE : serin portb.2, n2400, leftold.HighBYTE

    For counter=0 TO 7 'decoding
    right.0[counter]=rightold.0[counter*2]
    left.0[counter]=leftold.0[counter*2]
    Next counter
    Lcdout $fe, 1 'Clear screen
    Lcdout "Left: ", Dec left
    Lcdout $fe, $C0, "Right: ", Dec right
    Pause 100
    goto loop
    end
    Last edited by lerameur; - 6th February 2007 at 02:30.

  10. #330
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    Well here is the program that works:
    but changing portb.2 to porte.2
    it do not work.
    Wow, that should work...
    How about e.0 or e.1? Do they work?

  11. #331
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    no does not work
    I tried other B port and they work.
    I tried the analog ports like porta.0 and does not work.
    Should all the analog ports be used just for analog ?

    k

  12. #332
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Should all the analog ports be used just for analog ?
    Unless you disable the analog capability... yes

    As far as i remind of this chip PORTE<2:0> have multiplex analog stuff on that you have to disable first
    Code:
    ADCON1=7
    CMCON=7
    those will help... but better if you refer to the datasheet to make sure of everything.
    Last edited by mister_e; - 6th February 2007 at 03:48.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  13. #333
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    that would include port e too?
    I will need to use the analog port of portA later on too...
    wouldn't that disable them ? Or do I need to find anothe rport for my serin command ?
    I gues i have to play around with adcon (bit 0 to 3 )
    Last edited by lerameur; - 6th February 2007 at 03:57.

  14. #334
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yes indeed!
    Quote Originally Posted by Datasheet section 4.5
    4.5 PORTE and TRISE Register
    PORTE has three pins (RE0/RD/AN5, RE1/WR/AN6
    and RE2/CS/AN7)
    which are individually configurable
    as inputs or outputs. These pins have Schmitt Trigger
    input buffers.
    The PORTE pins become the I/O control inputs for the
    microprocessor port when bit PSPMODE (TRISE<4>) is
    set. In this mode, the user must make certain that the
    TRISE<2:0> bits are set and that the pins are configured
    as digital inputs. Also, ensure that ADCON1 is configured
    for digital I/O. In this mode, the input buffers are
    TTL.
    Register 4-1 shows the TRISE register which also
    controls the Parallel Slave Port operation.
    PORTE pins are multiplexed with analog inputs. When
    selected for analog input, these pins will read as ‘0’s.

    TRISE controls the direction of the RE pins, even when
    they are being used as analog inputs. The user must
    make sure to keep the pins configured as inputs when
    using them as analog inputs.

    Note: On a Power-on Reset, these pins are
    configured as analog inputs and read as ‘0’.
    Last edited by mister_e; - 6th February 2007 at 03:58.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  15. #335
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    I will need to use the analog port of portA later on too...
    wouldn't that disable them ? Or do I need to find anothe rport for my serin command ?
    I gues i have to play around with adcon (bit 0 to 3 )
    Datasheet section 11, register 11-2, PDF page 130

    Yes you got it !
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #336
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    yes yes yes not so big, ADCON1=2 works good for me
    thanks
    k

  17. #337
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Datasheet section 11, register 11-2, PDF page 130

    Yes you got it !
    DOH! I missed that too... jeez...somedays your on, somedays your off....
    I'm a big Logic ZERO today... I think I'll go invert myself for a few hours...

Closed Thread
Page 9 of 9 FirstFirst ... 56789

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 19:44
  4. Replies: 11
    Last Post: - 13th July 2005, 19:26
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

Members who have read this thread : 2

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