Serin woes - qualifiers not working


Closed Thread
Results 1 to 12 of 12

Hybrid View

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

    Default

    What is hitting the PIC?
    15 or 0F
    3 or 03

    Code:
    SERIN2  PORT.x,MODE,[WAIT("0F"),WAIT("03")]
    Notice SERIN2... Never did like the single...
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81

    Default

    Quote Originally Posted by mackrackit View Post
    What is hitting the PIC?
    15 or 0F
    3 or 03

    Code:
    SERIN2  PORT.x,MODE,[WAIT("0F"),WAIT("03")]
    Notice SERIN2... Never did like the single...

    Doesn't matter hex or decimal - it's the same binary number sent via serial...
    I had not noticed the WAIT feature in SERIN2. But the manual warns that at 9600 baud I *may* need an osc faster than 4MHz. Have not used SERIN2 before and it is giving me compiler ERRORS with the 12F509A.
    "Do or do not, there is no try" Yoda

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    Does this work on your 12F509?
    Code:
    DEFINE DEBUG_BAUD 9600
    DEFINE DEBUGIN_REG GPIO
    DEFINE DEBUGIN_BIT 1
    DEFINE DEBUGIN_MODE 0 '1=inverted
    
    X 	var 	byte			' dummy variable
    
    ' Pin Assignments
    SCADAin		var gpio.1		' data in via MAX232
    Ready		var gpio.4		' signal main processor to send data
    
    	low ready	' set low
    
    ' config
    	TRISIO = %000010		' set I/O directions (0 = output, 1 = input)
    	OPTION_REG = %11011111	' 12F508/9  bit 6 disables weak pull-ups
    
    Main:
    	debugin 200,NoOp,[wait($0F)]	' wait for address and command
    
    	pause 10		' wait for serial burst to end
    	high Ready	' signal main processor to send current data
    	pause 2		' with a 2mS pulse
    	low ready
    
    	goto main
    	
    NoOp:
    	GOTO Main
    	
    	END
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81

    Default Yes! :)

    Bruce,
    It WORKS! I had tried variations of DEBUGIN before but must have gotten the setup wrong! THANKS MILLIONS - you have no idea how much time I have put in on this (well, maybe you do...).

    Still don't know why SERIN did not work.

    Guy
    "Do or do not, there is no try" Yoda

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405

    Default

    Hi Guy,

    Glad I could help.

    One problem was having RETURN in NoOp. The timeout/label option for serin/serin2/debugin use a GOTO to jump to NoOp. Not good since you have no idea what's on the call stack, and no idea just where it's going RETURN to when it lands on this return after only a few mS when it times-out.

    Also .. serin/serout2 don't always work as expected at 4MHz for 9600 bps. debugin does.

    If you refer back to my 1st post you'll see that I hinted about all of these potential show-stoppers...;o)
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Serin timeout not working properly!
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 1st January 2010, 21:56
  2. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 20:02
  3. Serin with low voltage
    By f_lez in forum General
    Replies: 3
    Last Post: - 21st August 2006, 12:52
  4. Serin woes
    By Libretto in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th November 2004, 10:45
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 16: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