Wireless problem


Results 1 to 24 of 24

Threaded View

  1. #16
    Join Date
    Dec 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    Finally!

    At last I've been able to use USART!
    On the tx side I changed serout from N2400 to T2400 and the rx started to display correct data! Data is sent 10ms after powering the txer.

    99% of data is correctly showed on the display.

    Now I have to mount the sensor and send acquired data along with a sort of checksum.

    I could stay hours watching the display:0...1...2...3...4..... to see if some of my numbers gets lost. Watching it for a minute, no problems!
    So here is the working code for the TX:
    Code:
    INCLUDE "modedefs.bas"
    
    ANSEL=0
    CMCON0=%00000111
    
    define osc 4
    txpin   var gpio.4
    led     var gpio.5
    power   var gpio.2
    i       var byte
    
    low power
    
    loop:
        for i=0 to 9
          high power
          pause 10
          serout txpin,t2400,[$55,$55,$55,$55,$66,#i]
          low power
          high led
          pause 30
          low led
          pause 1000
        next i
    goto loop
    And, of course RX:
    Code:
    define  OSC 20
    Define 	LCD_LINES	4			' Settings for a 4x20 LCD
    Define	LCD_DREG	PORTB		'   4bit mode
    Define	LCD_DBIT	4			'
    Define	LCD_RSREG	PORTB		
    Define	LCD_RSBIT	3		 	
    Define	LCD_EREG	PORTB'      
    Define	LCD_EBIT	2
    
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFine HSER_BAUD 2400
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    'LCD Lines constants
    row4        con	$d4
    row3	    con	$94
    row2	    con	$c0
    row1	    con $80
    hser var byte
    
    intcon=0
    
    pause 500
    lcdout $fe,1
    lcdout $fe, row1, "** RX TEST **"
    
    loop:
          hserin [wait($66),hser]
          hserout [#hser]
          lcdout $fe, row3," hser: ",dec1 hser
    goto loop
    Last edited by supersonic; - 19th December 2007 at 13:29.

Similar Threads

  1. problem using GOSUB under interrupt
    By fobya71 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 5th March 2010, 20:52
  2. Problem with ASM IRQ using FSR0 on PIC18F252
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th March 2008, 21:48
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 09:12
  4. CM02 and RF04 wireless modules problem
    By vladimir059@hot in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 14th December 2006, 11:32
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 23:59

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