Society of Robots - Robot Forum
Software => Software => Topic started by: dannytemmerman on February 10, 2009, 11:42:19 AM
-
I want to let an action to happen for 1 second.
I want it to read the frequency of a signal during 1 second.
Please can anyone help me with this cause I already searched this forum and I can't find anything about this.
-
set your output high, delay for 1 second or 1000 ms, set output low, this is the easiest way to do this.
say i do this on my PIC in CCS C:
while(1)
{
output_high(PIN_D0) //I'm simply selecting the pin to use here and setting it high
delay_ms(1000) //1000 ms delay, or 1 second
output_low(PIN_D0)
}
This is a very basic set up of a loop
also take a look at the servo page on the SoR site it helps out abit too.
-
set your output high, delay for 1 second or 1000 ms, set output low, this is the easiest way to do this.
say i do this on my PIC in CCS C:
while(1)
{
output_high(PIN_D0) //I'm simply selecting the pin to use here and setting it high
delay_ms(1000) //1000 ms delay, or 1 second
output_low(PIN_D0)
}
This is a very basic set up of a loop
also take a look at the servo page on the SoR site it helps out abit too.
I think the op was asking to *read* the frequency of a signal, not generate one. And by the way, you code won't work. Since there is no delay at the end of the while loop, the signal will go high only a few cycle after it went low.
Regarding the original request, I'd use a counter (see your MCU datasheet for more details).
Something like this:
initialize_counter();
wait_millis(1000);
freq = read_counter();
I'm not sure why you want to use a while loop here.
Chelmi.
-
If this is for capturing your IR remote pulses, I don't understand why you don't want to build that IR widget, it is really easy. There is also the IR Decoder schematic on that knowledge base I showed you!
-
If this is for capturing your IR remote pulses, I don't understand why you don't want to build that IR widget, it is really easy. There is also the IR Decoder schematic on that knowledge base I showed you!
Do you need to program an IC to make the IR widget work?
I want to make the USB version then.
-
Do you need to program an IC to make the IR widget work?
I want to make the USB version then.
Yes they use a PIC, but if you're good you can do it with any IC. You will also need something like a ft232rl or cp2103 breakout from sparkfun.com for the USB connection to the IC. Then you can just do it all on a breadboard with the minimal configuration using that Fairchild QSE157 IR detector.
Once you get the data into your computer you use that free IR scope software to read the data. From there you can visually see what the pulse looks like.
-
Do you need to program an IC to make the IR widget work?
I want to make the USB version then.
Yes they use a PIC, but if you're good you can do it with any IC. You will also need something like a ft232rl or cp2103 breakout from sparkfun.com for the USB connection to the IC. Then you can just do it all on a breadboard with the minimal configuration using that Fairchild QSE157 IR detector.
Once you get the data into your computer you use that free IR scope software to read the data. From there you can visually see what the pulse looks like.
Is the PIC used to convert the usb signal?
Or what?
I don't now that much about IC?
-
From the link:
The IR Widget solves these problems by using a microcontroller to process the IR signal without interruption and send the data to the PC using ordinary asynchronous serial transmission. This allows the OS to service the serial port with standard drivers and allows the use of USB to serial converters. Simple circuits built with 74HC series parts can also be used. The data is sent in real time and is in a format that allows reasonably precise reconstruction of the actual IR signal received.
The code for the IC is linked at the bottom of the page, He also mentions using simple logic ICs '74HC' series in another version of the schematic.
http://www.compendiumarcana.com/irwidget/ (http://www.compendiumarcana.com/irwidget/)
-
From the link:
The IR Widget solves these problems by using a microcontroller to process the IR signal without interruption and send the data to the PC using ordinary asynchronous serial transmission. This allows the OS to service the serial port with standard drivers and allows the use of USB to serial converters. Simple circuits built with 74HC series parts can also be used. The data is sent in real time and is in a format that allows reasonably precise reconstruction of the actual IR signal received.
The code for the IC is linked at the bottom of the page, He also mentions using simple logic ICs '74HC' series in another version of the schematic.
http://www.compendiumarcana.com/irwidget/ (http://www.compendiumarcana.com/irwidget/)
So the parts that I need to buy to make this are:
an IR detector module
an usb male port
an ft232r
and an pic12f629
Is this correct?
And what is L1 in he schematic?
Can I program the PIC directly from USB?
-
Follow this schematic:
http://www.compendiumarcana.com/irwidget/usb_simple.png
L1 is usually a ferrite bead, but trust me and buy a breakout board and you won't need to do all that.
Parts list
http://www.sparkfun.com/commerce/product_info.php?products_id=718
http://www.sparkfun.com/commerce/product_info.php?products_id=8375 (get a handful, you use these like candy in electronics)
http://www.sparkfun.com/commerce/product_info.php?products_id=533
http://www.sparkfun.com/commerce/product_info.php?products_id=8377
http://octopart.com/info/Fairchild/QSE157
http://www.sparkfun.com/commerce/product_info.php?products_id=112
http://www.sparkfun.com/commerce/product_info.php?products_id=8023 (hookup wire for breadboarding)
and i've never used PICs because I heard their development environment isn't fee whereas all the tools to program an AVR are free.
I would try to do it with this (but the code would need to be modified a bit):
http://www.sparkfun.com/commerce/product_info.php?products_id=211
otherwise here is your PIC:
http://octopart.com/case+%2F+package--DIP-8/search?q=pic12f629
EDIT: MCU's need to be programmed using either a special programmer or via a serial port. You can check their respective datasheets.
PS. If you want to wait a bit, I plan on making one of these within the next couple weeks, and I could write up a tutorial.
-
Follow this schematic:
http://www.compendiumarcana.com/irwidget/usb_simple.png
L1 is usually a ferrite bead, but trust me and buy a breakout board and you won't need to do all that.
Parts list
http://www.sparkfun.com/commerce/product_info.php?products_id=718
http://www.sparkfun.com/commerce/product_info.php?products_id=8375 (get a handful, you use these like candy in electronics)
http://www.sparkfun.com/commerce/product_info.php?products_id=533
http://www.sparkfun.com/commerce/product_info.php?products_id=8377
http://octopart.com/info/Fairchild/QSE157
http://www.sparkfun.com/commerce/product_info.php?products_id=112
http://www.sparkfun.com/commerce/product_info.php?products_id=8023 (hookup wire for breadboarding)
and i've never used PICs because I heard their development environment isn't fee whereas all the tools to program an AVR are free.
I would try to do it with this (but the code would need to be modified a bit):
http://www.sparkfun.com/commerce/product_info.php?products_id=211
otherwise here is your PIC:
http://octopart.com/case+%2F+package--DIP-8/search?q=pic12f629
EDIT: MCU's need to be programmed using either a special programmer or via a serial port. You can check their respective datasheets.
PS. If you want to wait a bit, I plan on making one of these within the next couple weeks, and I could write up a tutorial.
Okay
Thanks
-
http://www.societyofrobots.com/robotforum/index.php?topic=6879.msg52202#msg52202
-
I looked more at that IR widget, and I got all the parts to make the simplified USB version, but I looked at the code and its written in ASM for the PIC. I was hoping it was going to be in C so I could easily translate it into C for the ATmega.
-
I looked more at that IR widget, and I got all the parts to make the simplified USB version, but I looked at the code and its written in ASM for the PIC. I was hoping it was going to be in C so I could easily translate it into C for the ATmega.
i have found a website for my remote (http://www.sbprojects.com/knowledge/ir/rcmm.htm)but now I don't now how to let my IC recognise it.
Do you now the code to recognise it?
Thanks