LOW PORTA cause serin2 not working.


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2009
    Posts
    3

    Default LOW PORTA cause serin2 not working.

    Really need some help here.
    I spent the whole weekends still not able to figure out the problem:
    LOW PORTA.4
    will cause serin2 stop working

    If I comment out the ' LOW PORTA.4 ' in my code.
    It works fine.

    Can someone shed any light onto the problem ?
    BTW, I use PBP250A. the chip is PIC12F635.

    Code:
    Include "modedefs.bas"
    
    OSCCON = $60
    TRISA = %11111110
    PORTA = GPIO
    BaudRate    CON 188
    
    STR1 VAR BYTE[12]  'Use as Lat and other
    STR2 VAR BYTE[12]   'Use as Log 
    T Var BYTE
    
    RS232_out var PORTA.1
    GPS var PORTA.2  
    RS232_in var PORTA.5
    
    GPIO.0 = 0
    GPIO.1 = 0
    GPIO.2 = 1
    GPIO.3 = 1
    GPIO.4 = 0
    GPIO.5 = 1
    
    Init:
        SERout2 RS232_out,BaudRate,["at+clip=1",10,13]
        SERIN2 RS232_in,BaudRate,2000,Init,[WAIT("OK"),T]
        
        
    read 1,STR1[0]
    if STR1[0] = "1" THEN
        LOW PORTA.4   'Here is the problem
        SERout2 RS232_out,BaudRate,["On",10,13] 
    else
        HIGH GPIO.4
        SERout2 RS232_out,BaudRate,["Off",10,13] 
    endif
    
    PAUSE 1000
    
    SERIN2 RS232_in,BaudRate,[WAIT("+CLIP: ",34,"+8600"), STR STR2\12]
    'Not enough RAM, use Lat to get caller id
    
        select case STR2[0]
            Case "1"
                write 1,STR2[0]
            Case "2"
                write 1,STR2[0]
            case "3"
                'Get Tracking
                SERout2 RS232_out,BaudRate,["ATA",10,13]
                PAUSE 1000
                SERIN2 GPS,BaudRate,2000,Reboot,[WAIT("$GPGGA,"),Skip 11,STR STR1\12,STR STR2\12] ' Fill the arrays with received data.
                SERout2 RS232_out,BaudRate,["AT+vts=*;+vts=",STR1[0],";+vts=",STR1[1],";+vts=",STR1[2],";+vts=",STR1[3],";+vts=",STR1[5],";+vts=",STR1[6],";+vts=",STR1[7],";+vts=",STR1[8],10,13]
                PAUSE 5000
                SERout2 RS232_out,BaudRate,["AT+vts=#;+vts=",STR2[0],";+vts=",STR2[1],";+vts=",STR2[2],";+vts=",STR2[3],";+vts=",STR2[4],";+vts=",STR2[6],";+vts=",STR2[7],";+vts=",STR2[8],10,13]
                PAUSE 5000
        end select
        SERout2 RS232_out,BaudRate,["ATH",10,13]
    
    Reboot:
    @ goto $
    Last edited by mikewen; - 23rd August 2009 at 21:04.

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

    Default

    Try replacing PORTA with GPIO???
    That chip does not have an A.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2009
    Posts
    3

    Default

    Quote Originally Posted by mackrackit View Post
    Try replacing PORTA with GPIO???
    That chip does not have an A.
    Tried that. Actually, I used GPIO.4 in the first place.

    I tried GPIO.0 too, but for GPIO.0, always stay low,
    not able to set high.

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

    Default

    I think this might help ...

    AllDigital.pbp
    http://www.picbasic.co.uk/forum/showthread.php?t=11100

    Or you could just ...
    Code:
    CMCON0 = 7
    But AllDigital would have told you that too.

    hth,
    DT

  5. #5
    Join Date
    Aug 2009
    Posts
    3

    Default

    Tried CMCON0 = 7 , still the same.

    Thank you for your help, it would useful if I decide to use other chips.

    Quote Originally Posted by Darrel Taylor View Post
    I think this might help ...

    AllDigital.pbp
    http://www.picbasic.co.uk/forum/showthread.php?t=11100

    Or you could just ...
    Code:
    CMCON0 = 7
    But AllDigital would have told you that too.

    hth,

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

    Default

    Woops,

    Also change ...

    TRISA = %11111110

    to

    TRISA = %11111100

    RS232_out is on PORTA.1



    No that won't matter, never mind. Duh!
    Last edited by Darrel Taylor; - 23rd August 2009 at 22:23. Reason: Not!
    DT

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

    Default

    What is "PORTA.4" connected to?
    Dave
    Always wear safety glasses while programming.

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

    Default

    No I have not looked at the data sheet . . .
    Code:
    TRISA = %11111110
    PORTA = GPIO
    I see you aliased GPIO as portA, shouldn't you also alias the TRISIO as TRISA, for this to work ?
    Code:
    TRISIO = TRISA
    GPIO  =  PortA
    PortA = %00101100
    TrisA = %11111100
    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. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  2. confused problem with interrupt in a working program
    By illuminator4 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th November 2008, 17:01
  3. Pic16f84 and RC5 kode
    By terminator in forum Bluetooth
    Replies: 5
    Last Post: - 18th June 2007, 21:40
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Problems with RC2 and RC3
    By Christopher4187 in forum General
    Replies: 11
    Last Post: - 29th May 2006, 17:19

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