Hi mackrackit,
I've posted it over on the VB thread (link below). Will be interesting to see if anyone has any ideas.
http://www.picbasic.co.uk/forum/show...3607#post93607
Dave
Hi mackrackit,
I've posted it over on the VB thread (link below). Will be interesting to see if anyone has any ideas.
http://www.picbasic.co.uk/forum/show...3607#post93607
Dave
Hi mackrackit,
Henrik looks like he's cracked the problem over on the VB thread.
I'll work on it tonight.
Dave
I saw that.
Seems obvious now.
Dave
Always wear safety glasses while programming.
Hi mackrackit,
That's because your'e clever. Hopefully I'll say that one day.Seems obvious now.
I've just posted a reply to Henrik on the VB thread (link below).
In a nutshell, the VB program is reading and displaying Random Bytes a treat now Apparently though birds fly in and out of nest boxes a lot more the 255 times a day when they're feeding young (It'll be interesting to see just how many) so a Word is needed as a counter, so half way there now then.
http://www.picbasic.co.uk/forum/show...3663#post93663
Dave
I have been called many things, clever has not been one of them
Birds..
WORD size , I would think will be large enough for a day? Week? Sooner or later that will not be large enough.
So when counting you can go very large even using BYTE size. Have the count be a power of 100.
A simple example.
Count to 100 with VAR1. When 100 is reached VAR2 increments and VAR1 starts over.
VAR2 will have 100s and VAR1 will have ones and tens.
But get the WORD thing working
Dave
Always wear safety glasses while programming.
See what I mean, very cleverCount to 100 with VAR1. When 100 is reached VAR2 increments and VAR1 starts over.
VAR2 will have 100s and VAR1 will have ones and tens.
I'll be on it tonight And probably tomorrow night too.But get the WORD thing working
Dave
I think it isBut get the WORD thing working
Have a look at the screen-shot on the other thread, what do you think?
http://www.picbasic.co.uk/forum/show...3747#post93747
Dave
looks good!!!
You are doing a fine job
And yes, I am following the other thread..
Dave
Always wear safety glasses while programming.
Cheers mackrackit, I wouldn't be without your and Henriks help though.You are doing a fine job
Yes the bare bones are taking shape with the Form, a lot of tweaks could be made though (having the COM Port open / shut automatically, clearing the buffer etc).
Next job to get the PIC to send High then Low Bytes and have VB join them back into a Word.
Fascinating stuff this.
Dave
Hi mackrackit,
Should I carry on tweaking the VB Terminal program for now or look at the rfPIC-TxRx program?
It's amazing how even learning how to make what appears to be the simplest of changes can take a whole evening. Sometimes I don't even know the term for what it is I'm trying to achieve / change...doh.
Dave
Looks like you have VB under control for what you want to do to start with.
Might as well work on the RF some.
I know what you mean about terms and things. One of the problems with being self taught I guess.
Dave
Always wear safety glasses while programming.
Yes, having a VB Terminal program via a usb / db9 cable that magically receives Random numbers from the PIC to pc is a result alrightLooks like you have VB under control for what you want to do to start with.
I've managed to get a txt file to open with a button click to write the Bird count Bytes to.
Seriously interesting stuff this.
Dave
Hi mackrackit,
I haven't left the Country. I've had a few things to deal with of late but still learning in between times.
Dave
I figured as much.
Are you working on RF or VB lately?
Dave
Always wear safety glasses while programming.
I've spent some time looking at Bruce's rx / tx program to try and figure out 1/ exactly how it works and 2/ To modify it to transmit (and then receive) firstly a byte, then a word to send to the Terminal program.Are you working on RF or VB lately?
On the VB front, I'm looking to make the VB Terminal program read the transmitted data from the PIC and auto-write that information to a txt file.
I guess I'm riding two horses (and juggling three balls in my private life right now). I guess I should focus on one (the VB or the rx/tx that is).
Dave
Last edited by LEDave; - 30th September 2010 at 14:31.
Hi mackrackit,
Are these 'private messages' you can send on this Forum private / ish.
Dave
Yes, they are private.
Dave
Always wear safety glasses while programming.
Hi everyone,
I've just managed to get the rfPIC TX/RX to work and blink the two led's on the PICkit1. It took me over an hour to figure out and find which program and where the program was on my hdd (must improve my house keeping). I still find it amazing that it's radio waves travelling through the air that makes all this work.
Ok, so the program's I used were the microchip rx/tx.hex demo program's written in assemly language. However, for the project I need to compile Bruce's TX / RX program's which are written in PB with a little assembler in the mix and compile them using the MPLAB compiler (have I got that right?) then modify the code for the project.
So step one, I need to go away and learn how to compile a program and create a hex file using MPLAB (something I've never done before) I'm pretty sure I've a tutorial somewhere.
Just a little refresher, am I right in thinking that PBP compiles PIC Basic and MPLAB compiles everything, well PIC Basic and Assembly?
Good to be back.
Dave
Last edited by LEDave; - 2nd November 2010 at 21:29.
You do not have to use MPLAB. MPLAB is just an editor, basically.
But you do or should be using MPASM.
To do this with Micro Code Studio go to Tools- Compiler Options then the assembler tab. Check MPASM.
Good to have you back.
Dave
Always wear safety glasses while programming.
Cheers mackrackitGood to have you back.
Well I can't actually see 'Tools' on the toolbar, here are three screen shots which I think show my current setup:To do this with Micro Code Studio go to Tools- Compiler Options then the assembler tab. Check MPASM.
I thought I'd add a screenshot of the 'toolbar' so you can see what I've got highlighted and what's greyed out under current settings. Does this look ok to you?
That looks about right for that chip. You should have save available though! Maybe you need to have some code in the window for that. Looks like most of the greyed out options are for the in circuit debuger. Some other chips: 16F627(A), 16F628(A), 16F73, 16F74, 16F76, 16F77, 16F870, 16F871, 16F873(A), 16F874(A), 16F876(A), 16F877(A), 16F87, 16F88, 18F242, 18F248, 18F252, 18F258, 18F442, 18F448, 18F452, 18F458, 18F1220, 18F1320, 18F2220, 18F2320, 18F4220, 18F4320, 18F6620 and 18F8620
have an in circuit debug available for them, but as you can see, they are a bit limited. It is an interesting feature though.
Walter
Last edited by ScaleRobotics; - 3rd November 2010 at 00:58.
http://www.scalerobotics.com
Hi Walter
Exactly that, I added some code and 'Save' changed from greyed out to Bold.You should have save available though! Maybe you need to have some code in the window for that.
That was interesting, I changed the chip from a 12F675 to a 16F627(A) and the RUN-STOP-STEP-PAUSE changed from greyed out to Bold,
like you said then that must be because the chip has a Debug available to them (I've never used Debug).
Cheers: Dave
Last edited by LEDave; - 3rd November 2010 at 01:55.
Hi Dave,
Bruce did a great write up on how to use it here: http://www.rentron.com/PicBasic/MCS_X3.htm
I used to use it, and it is pretty cool. When I needed to try to debug things that were using the serial port already, I had to find other ways to debug (not necessarily better). But I would say it can be pretty helpful when you are starting out.
The way it debugs is that it adds code into your program to talk back and forth through the serial port. That way it updates registers, etc so you can see them in the ICD. It uses a fair amount of resources, so it slows things down a great deal, but it is fast enough for a lot of projects.
Last edited by ScaleRobotics; - 3rd November 2010 at 02:10.
http://www.scalerobotics.com
Thanks for that Walter and the link, very interesting and something else to look into.
Dave
We've touched on this before, when I compile Bruce's TX program I get these errors (see attachment). This is because as mackrackit said earlier in the thread:
And:Bruce is using PM for an assembler in that example.
Also:PM is the assembler from the Pic Basic folks. It works well on the older and smaller chips.
So the compiler error is due (I think) to having the wrong type of configuration fuse in Bruce's program (see second attachment) and I need to change them to this type (see third attachment) and it will compile.MPASM from MicroChip works for everything.
Have I got that right?
Dave
You will want to change these lines in your code
toCode:@ DEVICE PIC12F675,MCLR_OFF,INTRC_OSC_NOCLKOUT,WDT_OFF,BOD_OFF @ DEVICE PWRT_ON,PROTECT_OFF
when using MPASM as an assembler.Code:@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
And comment the *.inc file in the PBP directory.
http://www.picbasic.co.uk/forum/cont...o-your-Program
Dave
Always wear safety glasses while programming.
Hi mackrackit,
Well I changed the lines of code and compiled the program without commenting the the *.inc file in the PBP directory and the compiler gave the error below(see attachment). I was expecting that as per your Forum link.
It's thethat's causing me the problem and I've conFUSED myself big time here. The only .INC files I can find are in this path:C:\Program Files\Microchip\MPASM Suite. I've read the Forum page link you posted up but I still can't see what I need to do.comment the *.inc file in the PBP directory.
Another pointer if poss please.
LedimDave
C:\PBP
That is where the inc's are. If things are installed in the default location.
The ones in the MPASM directory do not modify.
Dave
Always wear safety glasses while programming.
Can't believe I couldn't find the PBP.INC files talk about under my nose
Anyway moving on, I've found the 12F675.INC (PBP) file and think I've 'commented out' the right line (see attachment) which probably means I haven't Is what I've done what I'm meant to do?)
DaveCode:;device pic12F675, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
Yes, that is the correct line to comment when setting the fuses PM style in code space. Comment the line starting "__ config" when using MPASM style.
Both can be commented at the same time.
Dave
Always wear safety glasses while programming.
Hi mackrackit,
I did both and the TX program compiled with no errors In the morning I'll change the RX fuses and then it's onto the programs themselves to send and receive the bird_box_count_data, exciting stuff.Both can be commented at the same time.
Dave
I've had a good night tonight. I've managed to get Bruce's RX program which uses a PIC12F676 (which I don't have) to work on a 16F684 which I do, so well pleased.
Dave
WOOHOO!!!
Now you getting it. Good job!!!
Dave
Always wear safety glasses while programming.
WOOHOO!!!
Well another step forward for sureNow you getting it.
Cheers mackrackit.Good job!!!
Dave
In Bruce's TX program under the section of Constants, he has PreAmble CON with a value of 15 HEX (I'm happy with that) Then he has Synch CON "~" = 7E HEX(I think) but how does "~" = anything if you see what I mean?
DaveCode:' Constants PreAmble CON $A5 ' 10100101 preamble Synch CON "~" ' 01111110 synch byte
In Bruce's TX program under the section of Constants, he has PreAmble CON with a value of 15 HEX (I'm happy with that) Then he has Synch CON "~" = 7E HEX(I think) but how does "~" = anything?
*** Ah, I just figured it out 7E HEX is the ASCII value for the ~ symbol right?***Code:' Constants PreAmble CON $A5 ' 10100101 preamble Synch CON "~" ' 01111110 synch byte
So sending and receiving that symbol acts as a Synch BYTE is that right?
Plus sorry I seem to have posted twice instead of editing.
Dave
""So sending and receiving that symbol acts as a Synch BYTE is that right?""
Yup.
Dave
Always wear safety glasses while programming.
Cheers mackrackit.
It's a funny game this programming, I've been scratching my head for ages trying to figure out how the Synch BYTE worked, then when the penny dropped it all seemed fairly obvious (it didn't until the penny dropped though). Still, another piece fits into the learning jigsaw I guess.
Dave
I've been doing lots of reading and slowly trying to work my way through the TX / RX progs to get an understanding of what's actually happening, the sequence etc. One thing I can't see though is this.
In the TX program we've got:
And the RX has:Code:SEROUT2 D_OUT,BAUD,[PreAmble,Synch,DAT_OUT,DAT_OUT,CHK_SUM]
So my Q is this: What's happened to the 'PreAmble BYTE' ?Code:SERIN2 D_IN,N2400,[WAIT(Synch),DAT_IN1,DAT_IN2,CHK_SUM]
The Manual says:Code:PreAmble CON $A5 ' 10100101 preamble
So in this case that would be the Synch BYTE right? Synch BYTE always first (because of the WAIT command), the rest to follow. I can't see where / how the preAmble arrives though.The list of data items to be received may be preceded by one or more qualifiers between parenthesis after WAIT. SERIN2 must receive these bytes in exact order before receiving the data items. If any byte received does not match the next byte in the qualifier sequence, the qualification process starts over
Also this from WIKI:
http://en.wikipedia.org/wiki/Syncword
Suggest to me that a PreAmble and a Synch are two ways of doing the say thing, or very similar, have a got that on right?
Dave
Last edited by LEDave; - 8th November 2010 at 21:54.
Bookmarks