Hey guys a quick post here.
Since the first time I used XBees (2 years back?) I noticed that they were dropping bytes. This is quite annoying as it disturbs the normal flow of your device. What I did fixed it for good and I never had a single bit dropped from XBees ever again, and let me tell you I sent many thousands bytes so far 🙂
Anyway, what you need to do is really simple. You need to assign a destination to your transmission. You do that by first entering the command mode (when using the AT firmware). To do that you need to enter the “command sequence character” three times in a row i.e. for the default settings enter “+++” (without the quotes) to the terminal. The XBee should reply with “OK” and you have a short period of time to enter an AT command. Next you need to send the destination XBee by entering “ATDN<DESTINATION ADDRESS HERE>”. And that’s it 🙂
Let’s do an example. You have two XBees, one is called BASE and the other one is called HELI. Oh make sure you name your XBees by changing the Node Identifier in the settings. If HELI wants to talk to BASE it will
- Enter “+++”
- Wait for “OK”
- Enter ATDNBASE
Now you can send as much data as you want and you wont loose a byte. This is so simple. Do the opposite i.e. BASE->HELI and you will have a pretty good two way communication.
Let me know if you need any help
Incoming search terms:
So I was thinking its time to start posting some complete projects. I am starting with some really basic projects to help the people just starting with PICs. However, before doing that we need to have a common platform to develop on, so we don’t need to discuss about it every time. In this first project (see how I codenamed it PR1!) we will create a minimal PIC platform which we will use in future projects. I will list everything you will need to buy to get you started.
As the brains of this platform I am choosing the PIC18F4520 which I believe it is a pretty nice PIC to work with, having enough peripherals, memory and speed for any beginner project. Let’s see the components you will need:
- Breadboard – if you don’t have one, you really need to buy one!
- 10MHz oscillator
- 2 x 22pF capacitors
- 10kOhm resistor
- 7805 Voltage regulator
- PICKit 2 (or 3)
Using the above components will allow to build a functional board even though more components are needed to be “perfect” (smoothing capacitors on the regulator, a couple of diodes between the programmer and the supply and more). Of course it would be nice to add a switch, a reset button, LEDs, and the list goes on, but this would increase the cost of the board. Consider this as a quick-and-dirty solution just to get you started. Maybe on a future post we create a more complete board. For now I believe this is a good starting PIC testing board.
Using the schematic below, hook up the board. I am also attaching a photograph of my own testing board for reference. You also need some sort of power. I find it convinient to use the 9V battery holder and connect it either with a 9V battery or a power supply. Feel free to use any kind of power supply as long as it is between 6V and 12V. If you are (somehow) using a 5V supply, take the 7805 regulator out.
After connecting everything it would be a good idea to write a simple program to check the functionality of the board. I have a simple LED blinking program already compiled. So, using your programmer, transfer the HEX file (attached at the end of this post) to your PIC. To test this out you will need an LED and an 1kOhm resistor connected to the A0 pin as shown in the figure. Turn on the PIC and the LED should be blinking every 1 sec. If not then something is wrong :). But don’t worry. The board is simple enough to figure out where the mistake is and if you have trouble you can always ask me.
So now you have a board to play with 🙂
Incoming search terms:
- pic projects for beginners (36)
- pic platform (15)