serin with pic18f2525


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    26

    Smile serin with pic18f2525

    Hi everyone hope you can help me.
    I have been updating a pic 16f876A program to run on a 18F2525 @8 MHz
    header details are
    'pic18f2525
    DEFINE OSC 8
    OSCCON = %11111111

    DEFINE LOADER_USED 1 ' Comment out if not using boot-loader
    INCLUDE "modedefs.bas"

    INTCON2.7 = 0 'enable weak pull-ups on PORTB
    but when I run it crashes after about 1 minute every time except when I remove this line

    SerIn2 portC.7,16572,600, Loop,[wait("FMS"),dec3 B0]

    It seems simple enough but I am just stuck.

    the transmit bit works fine

    SEROUT2 PortC.6,16572,["LOADX",#volt1,"BATY",#TXBat]

    what could it be ?

    any suggestions

    many thanks again
    John
    Last edited by J_norrie; - 21st August 2008 at 18:38.

  2. #2
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    26

    Default More Information

    Hi again I hope someone will look at this post and help me with my problem. I have reduced the code to a minimum but it still runs for about a minute then crashes.

    Any help most wecome
    thanks again John

    'pic18f2525
    DEFINE OSC 8
    OSCCON = %11111111

    DEFINE LOADER_USED 1 ' Comment out if not using boot-loader
    INCLUDE "modedefs.bas"
    TXBAT var word
    Volt1 var word
    SIGN VAR BYTE
    B0 VAR BYTE
    B0 =100
    SIGN = 1
    VOLT1 = 2222
    TXBAT = 90
    ' ----------------------------------------------------------------------------
    ' MAIN lOOP
    ' ----------------------------------------------------------------------------

    Loop:
    GOSUB Transmit
    GOSUB SerialInput
    GOTO Loop

    ' ----------------------------------------------------------------------------
    ' Get Serial Input to serial port 9600 baud inverted
    ' ----------------------------------------------------------------------------
    Serialinput:


    SerIn2 portC.7,16468,1000,loop,[wait ("FMS"),dec3 B0]
    RETURN

    ' ----------------------------------------------------------------------------
    ' Get Load Value and output to serial port 9600 baud inverted WITH - SIGN
    ' ----------------------------------------------------------------------------
    Transmit :

    SEROUT2 PortC.6,16468,["SIGN",#SIGN,"LOADX",#volt1,"BATY",#TXBat,"SIGN",#SIGN,"LOADX",#volt1,"BATY",#TXBat,"SIGN",#SIGN,"LOADX",#volt1,"BATY",#TXBat]

    RETURN

  3. #3
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    26

    Default Still no Joy

    Hi there,

    I have tried the code on a 18f2220 but still the same problem. I tried using DEBUGIN but still the same. Is it to do with the settings of the Hardware UART?, I am not actually sending anything to the pic only sending data at present, but it still fails if I include the serin2 line.

    anyone out there with any suggestions . I would be eternally grateful

    cheers John

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

    Default

    I am just making a wild guess, maybe PORTC.7 should be set LATC.7.
    http://www.picbasic.co.uk/forum/show...57&postcount=9

    If I understand this right, LATC will set the pin digital and PORTC is schmitt trigger.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jun 2006
    Location
    Glasgow, Scotland
    Posts
    26

    Default 18F2525 issues

    thanks Dave, I will give it a try, under pressure at the moment but I will let you know if it worked.

    many thanks again
    john

Similar Threads

  1. Serin EEPROM Programmer
    By dirtbiker5627 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 24th February 2010, 23:48
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. serin question?
    By sachymo in forum General
    Replies: 5
    Last Post: - 27th July 2008, 10:04
  4. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  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 : 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