Wireless Project Revisited using Basic Language

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Wireless Project Revisited using Basic Language

Post by bitfogav » Thu Mar 29, 2012 8:45 am

Hey guys do you remember these? Im sure Brad does..
wireless2.jpg
wireless2.jpg (11.33 KiB) Viewed 10100 times
These are two devices one Transmitter (TM1000-1) and one Receiver (RM1SGS) with a range of 1000m and they are very cheap! Can still be brought from Ebay. Awhile ago I put an Assembly language wireless project together which can be found here Bitfogavs Wireless Project.
Well I decided to revisit this project but make it from a Basic language using Proton Basic, Proton Basic uses some of the more baseline Microchips like the 12F, 16F PICs. maybe we can convert Stacy to the Basic language now, hey Brad?! hehe!.

For this im going to use the 12F675 8pin microchip, and the RSIn and RSOut commands from the Proton Basic language.

heres an example of the Transmitter code I have so far:

Code: Select all

Device = 12F675

    Xtal = 4

            ' Set ext 4mhz crystal
	Config FOSC_XT, CPD_OFF, CP_OFF, BODEN_OFF, MCLRE_OFF, PWRTE_ON, WDT_OFF	
    
    All_Digital = TRUE   ' set CMCON = 7
    INTCON = 0           ' Disable Interrupts   

'-------[DECLARE SERIAL DATA]--------------------------------------------				
		Declare Rsout_Pin GPIO.2             ' Assigns the Port and Pin that will be used to Output serial data.
        Declare Rsout_Mode 0                 ' Sets the serial mode.
        Declare Serial_Baud 1200             ' Baud Rate to receive and transmit data.        
        Declare Rsout_Pace 10                ' Delay between characters transmitted by the Rsout command.		
		
'-------[ASSIGN PINS]----------------------------------------------------
        Symbol Led  = GPIO.0
        Symbol btn1 = GPIO.1
        
'-------[ASSIGN GENERAL VARIABLES]---------------------------------------
        Dim byteOut As Byte
        Dim looop As Byte
    
'-------[INITIALISE THE PICMICRO]----------------------------------------              
        TRISIO = %111010				' Set pin functions (Input/Output)
        Output Led
        Low Led
        Input  btn1
        
        ' Init variables
        byteOut = 1
        DelayMS 100						' Wait for the PICmicro to stabilise       
    
'-------[MAIN PROGRAM LOOP STARTS HERE]----------------------------------
  
While 1 = 1	    ' Create an infinite loop
          
          ' check if button pressed
          If btn1 = 0 Then 
            High Led 
            
            RSOut Bin 43690        
              
              For looop = 0 To 2
                RSOut "Z" , Dec byteOut, 13
              Next
            
            DelayMS 500 
            Low Led
		
          EndIf  
             
Wend    ' Loop prog

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Wireless Project Revisited using Basic Language

Post by brad » Sun Apr 01, 2012 1:47 pm

I remember this!

I actually didn't ever get my version to work. However now that I am using Basic - it may just be a whole heap easier. Great to see you getting back into the wireless projects. Do you have a plan for what you might do with it?

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Wireless Project Revisited using Basic Language

Post by bitfogav » Sun Apr 01, 2012 6:26 pm

Well I do have an idea, A fews years ago I made a simple 2Led flasher for a friends outside alarm box on his house, which used a potentiometer connected to an analogue pin of a microcontroller to control the delay between flashes, I was thinking of actually making up something for him so he could adjust the time delay between flashes with a wireless remote.

A very simple design but a good deterrent against burglars!.

heres a picture of the veroboard I made up for him a few years ago:
2ledflasher.jpg
2ledflasher.jpg (9.29 KiB) Viewed 10091 times
schematic:
2ledflasherSch.jpg
2ledflasherSch.jpg (15.99 KiB) Viewed 10091 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Wireless Project Revisited using Basic Language

Post by brad » Mon Apr 09, 2012 6:35 pm

That's a great idea. Would the receiver connect directly to the 8pin PIC you already have there?

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Wireless Project Revisited using Basic Language

Post by bitfogav » Mon Apr 09, 2012 7:31 pm

Yes Brad, there is 3 spare pins on the PIC on the original board so I may use one of them for the Receiver. :)

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Wireless Project Revisited using Basic Language

Post by bitfogav » Wed Apr 11, 2012 3:25 am

Heres my two test codes which work for the RF modules.

Tx Code:

Code: Select all

Device = 12F675

    Xtal = 4
    
        Reminders = Off
        Config XT_OSC, WDT_OFF, PWRTE_ON, BODEN_OFF, CPD_OFF, CP_OFF, MCLRE_OFF 
        Reminders = On
    
    Set_OSCCAL           ' Calibrate the on-chip oscillator
    All_Digital = TRUE   ' set CMCON = 7
    INTCON = 0           ' Disable Interrupts
   
'-------[DECLARE SERIAL DATA]--------------------------------------------                               
        Declare Rsout_Pin GPIO.2             ' Assigns the Port and Pin that will be used to Output serial data.
        Declare Rsout_Mode 0                 ' Sets the serial mode.
        Declare Serial_Baud 1200             ' Baud Rate to receive and transmit data.        
        Declare Rsout_Pace 10                ' Delay between characters transmitted by the Rsout command.
                                
'-------[ASSIGN PINS]----------------------------------------------------
        Symbol Led  = GPIO.0
        Symbol btn1 = GPIO.1
        
'-------[ASSIGN GENERAL VARIABLES]---------------------------------------
        Dim byteOut As Byte
        Dim looop As Byte
    
'-------[INITIALISE THE PICMICRO]----------------------------------------              
        TRISIO = %111010        ' Set pin functions (Input/Output)
        Output Led
        Low Led
        Input  btn1
        
        ' Init variables
        byteOut = 1
        DelayMS 100             ' Wait for the PICmicro to stabilise
         
'-------[MAIN PROGRAM LOOP STARTS HERE]----------------------------------
While 1 = 1     
        
          If btn1 = 0 Then  ' test button
          
            High Led    ' turn on led to show that button was pressed
            DelayMS 50  ' button debounce
                 
            ' send out some data so stabilize the RF receiver 
            RSOut Bin 43690        
              ' then send header Z, then your data byte
              ' send data serveral times to make sure Receiver receives data
              For looop = 0 To 2
                RSOut "Z" , Dec byteOut, 13
              Next
            
            DelayMS 500         
                
          EndIf  
          
         Low Led  ' turn off led
            
Wend

RX Code:

Code: Select all

Device = 12F675

    Xtal = 4
    
        Reminders = Off
        Config FOSC_XT, CPD_OFF, CP_OFF, BODEN_OFF, MCLRE_OFF, PWRTE_ON, WDT_OFF
        Reminders = On
    
    Set_OSCCAL           ' Calibrate the on-chip oscillator
    All_Digital = TRUE   ' set CMCON = 7
    INTCON = 0           ' Disable Interrupts
         
'-------[DECLARE SERIAL DATA]--------------------------------------------
        Declare Rsin_Pin GPIO.2             ' Assigns the Port and Pin that will be used to input serial data.
        Declare Rsin_Mode 0                 ' Sets the serial mode.
        Declare Serial_Baud 1200            ' Baud Rate to receive and transmit data.
        Declare Rsin_Timeout 5000           ' Time, in ms, that Rsin will wait for a start bit to occur.                                                                        
'-------[ASSIGN PINS]----------------------------------------------------
        Symbol Led  = GPIO.0
        
'-------[ASSIGN GENERAL VARIABLES]---------------------------------------
        Dim byteIn As Byte
    
'-------[INITIALISE THE PICMICRO]----------------------------------------              
        TRISIO = %111100                ' Set pin functions (Input/Output)
        Output Led
        High Led

        ' Init variables
        DelayMS 100                     ' Wait for the PICmicro to stabilise       
            
'-------[MAIN PROGRAM LOOP STARTS HERE]----------------------------------
While 1 = 1
        
      ' Wait for the value "Z" to be received
        RSIn {Time_Out}, Wait("Z"), Dec byteIn           
 
           ' Put your code here when correct data received
            Low Led     ' turn off led to show data received
            DelayMS 2000
         
        Time_Out:
         ' This is where we go if nothing is received in 5 Secs
          High Led

Wend


Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 1 guest