Serin Problem with 12F629/PBP


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2009
    Posts
    4

    Default Serin Problem with 12F629/PBP

    Hello all,

    I am having a devil of a time getting my SERIN to work with a 12F629. I connected the RS232 pin2 with a 1k resistor connected to pin7 of the 629, RS232 pin 3 with a 22.1k resistor to pin 6 of the 629, and RS232 pin 5 to pin8 of the 629. I am using a modified serqual PBP example program that writes Tom and Jerry to hyperterm. The output portion works fine... The input I keep banging my head on. I cannot get past the input.. I modified the original to turn off analog stuff gleaned from the archives. Also used a constant to load the pin number and directly set the port number. Any help would be appreciated..

    George


    ' SERIN Command w/ Qualifiers
    '
    ' "Crude" serial filter for C Style Comments

    INCLUDE "modedefs.bas"
    TRISIO.0 = 0
    TRISIO.1 = 1
    CMCON = 7
    OPTION_REG.7 = 0
    VRCON = 0

    SO CON 0
    SI CON 1
    B0 VAR BYTE

    SerOut 0,N2400,["TOM and JERRY",$D,$A]

    wait1: SerIn SI,N2400,["//"],B0
    SerOut 0,N2400,["Serial In RCVD",$D,$A]

    loop: SerOut SO,N2400,[B0]
    IF B0 = 13 Then wait1
    SerIn SI,N2400,B0
    GoTo loop

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


    Did you find this post helpful? Yes | No

    Default

    I think I have never used serin successfully, therefore let me ask <b>you</b> an <u><font color = red><b>unqualified question:</u></b></font color> How many letters can you store in a single byte variable, like B0 ? And as I am leaving the house right now and do not have my manual handy, I may be all wet as to this line of questioning.
    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.

  3. #3
    Join Date
    Mar 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Joe,

    Thanks for replying to my post. Of course, the single byte variable can only store one ascii charactor (char in C). One charactor is just enough to reply to a Yes/No ( Y )/( N ) query presented with SEROUT. Please understand that I am just trying to get this to work and will build on that... As of now, I cannot get past inputting a single char SERIN. I dont know if it is my hw implementation ( using MEL suggested resistors ), am missing something unique to 12F629 programming, or my serial port setup on the PC.

    Further information about my configuration:
    - Using a 4Mhz external resonator
    - Selected XT on meProg..
    - SEROUT working beautifully...
    - Hyperterm set to 8N1 and receives ASCII from 629

  4. #4
    Join Date
    Mar 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Hello All,

    I got SERIN to work.. I summized that my code was no different than half a dozen other 629/675 SERIN code snippets in the archives.. So I thought that maybe I was barking up the wrong tree ( code problem ). Maybe my problem was the input interface. I was using the MEL suggested 22k resistor ( 22.1k ) on the PIC input with no luck. I Googled "PIC RS232 Interface" and found multiple links that use only a 10k input resistor. I changed my input resistor to 10k and bang it worked...

    Thanks everyone for the support. As I learn more, I hope to be an active member on this board.

    George

  5. #5
    Join Date
    Mar 2009
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    I know little english.
    I also have problems 12f675 serout2.
    problem was solved by adding "define OSCCAL_1k 1".
    Will benefit from this example that would send.
    My my script below

    @ device pic12f675, intrc_osc, wdt_on, bod_on, cpd_off, pwrt_on, mclr_off, protect_off

    DEFINE OSCCAL_1k 1
    DEFINE ADC_BITS 8 ' Set number of bits in result
    DEFINE ADC_CLOCK 3 ' Set clock source (rc = 3)
    DEFINE ADC_SAMPLEUS 10 ' Set sampling time in

    CMCON = 7 ' Comparators OFF
    ANSEL = %00100001 ' AN0 enabled (last 4 bits are enable bits {AN3:AN0}
    ADCON0 = %11000001 ' VCC Vref / Turn On ADC Module
    trisio = %001011 ' 1 giriş 0 Çıkış

    SYMBOL AN_OKU = GPIO.0
    SYMBOL TX = GPIO.5
    VOLT VAR WORD

    BASLA:
    ADCIN AN_OKU, VOLT
    pause 10
    VOLT.highbyte = ADRESH
    VOLT.lowbyte = ADRESL
    SEROUT2 tx,16780 ,["volt : ", dec5 volt, ?10,?13 ]
    pause 1000
    GoTo basla
    Last edited by timurak; - 7th March 2009 at 22:33.

  6. #6
    Join Date
    Mar 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default

    Thanks Timurak,

    I didnt initially post it, but my platform uses the external 4 MHz. oscillator, but thank you for answering my post. I did fix the input problem with a change in the resistor from 22k to 10k. Now Serin is working flawlessly.

    george

Similar Threads

  1. Serin Problem 16f819
    By jjohannson in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd March 2007, 23:50
  2. Serin serout problem
    By lerameur in forum mel PIC BASIC Pro
    Replies: 336
    Last Post: - 6th February 2007, 05:25
  3. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 20:02
  4. serout and serin problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th April 2006, 20:44
  5. 16F877A serin problem with baud rate 19200
    By leemin in forum Serial
    Replies: 1
    Last Post: - 31st July 2005, 10:45

Members who have read this thread : 1

You do not have permission to view the list of names.

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