It is currently Tue May 21, 2013 1:47 pm

All times are UTC + 10 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Wireless Project Revisited using Basic Language
PostPosted: Thu Mar 29, 2012 8:45 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Mar 28, 2010 9:03 pm
Posts: 699
Location: United Kingdom
Hey guys do you remember these? Im sure Brad does..
Attachment:
wireless2.jpg
wireless2.jpg [ 11.33 KiB | Viewed 459 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:
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


Top
 Profile  
 
 Post subject: Re: Wireless Project Revisited using Basic Language
PostPosted: Sun Apr 01, 2012 1:47 pm 
Offline
Site Admin
Site Admin
User avatar

Joined: Fri Mar 26, 2010 10:30 pm
Posts: 1860
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?


Top
 Profile  
 
 Post subject: Re: Wireless Project Revisited using Basic Language
PostPosted: Sun Apr 01, 2012 6:26 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sun Mar 28, 2010 9:03 pm
Posts: 699
Location: United Kingdom
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:
Attachment:
2ledflasher.jpg
2ledflasher.jpg [ 9.29 KiB | Viewed 450 times ]


schematic:
Attachment:
2ledflasherSch.jpg
2ledflasherSch.jpg [ 15.99 KiB | Viewed 450 times ]


Top
 Profile  
 
 Post subject: Re: Wireless Project Revisited using Basic Language
PostPosted: Mon Apr 09, 2012 6:35 pm 
Offline
Site Admin
Site Admin
User avatar

Joined: Fri Mar 26, 2010 10:30 pm
Posts: 1860
That's a great idea. Would the receiver connect directly to the 8pin PIC you already have there?


Top
 Profile  
 
 Post subject: Re: Wireless Project Revisited using Basic Language
PostPosted: Mon Apr 09, 2012 7:31 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sun Mar 28, 2010 9:03 pm
Posts: 699
Location: United Kingdom
Yes Brad, there is 3 spare pins on the PIC on the original board so I may use one of them for the Receiver. :)


Top
 Profile  
 
 Post subject: Re: Wireless Project Revisited using Basic Language
PostPosted: Wed Apr 11, 2012 3:25 am 
Offline
Moderator
Moderator
User avatar

Joined: Sun Mar 28, 2010 9:03 pm
Posts: 699
Location: United Kingdom
Heres my two test codes which work for the RF modules.

Tx Code:
Code:
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:
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



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme made by Keenen Wheeler