ok.. I'll go ahead and clean that up and post it again..
ok.. I'll go ahead and clean that up and post it again..
heres the new cleaned up version of the old code. I haven't hooked it up to the pc but this one seems to work just great (it pulses the pin selected for output). I did that stuff you were talking about with the goto command. thanks for the help.
as for the xtal, yeah, I'm going to have to condede to that. I was hoping to see if I could just get by without one, but I'm going to probably have to give those pins back to the xtal. I was kinda getting away without needing an xtal due to the fact that nothing else was hooked to it whilst I was testing this code.
I've also been looking for a tutorial on setting all pins on the device to digital. it seems the settings I have do that, but I really don't have a clear understanding off the following ansel, anselh and adcon. I looked in the microchip pdf but it was rather confusing.
thanks for the help with the code.
Code:INCLUDE "modedefs.bas" define osc 4 @ device PIC16f690, MCLR_OFF info var byte[5] trisa = %00000000 trisb = %00000000 trisc = %00000000 ansel = 0 anselh = 0 poll: pause 100 SERIN portc.5, N2400, 1000, nxt, ["r"], info[0] 'Get input SERIN portc.5, N2400, info[1] 'get the word "relay" SERIN portc.5, N2400, info[2] SERIN portc.5, N2400, info[3] SERIN portc.5, N2400, info[4] SEROUT portb.7, N2400, [info[1], info[2], info[3], info[4] ] pause 500 goto poll nxt: serout portb.7, N2400, ["timeout"] goto poll
A tutorial for the analog settings would be great, but this should help some
http://www.picbasic.co.uk/forum/showthread.php?t=561
and here is a way to use the ADC that is a little different than the manual, I still prefer this method.
http://rentron.com/PICX2.htm
Read through the above example, when you understand how it works it should really help you understand the inner workings.
Post your questions.
Dave
Always wear safety glasses while programming.
hey, my code is working great, but I have been running into some problems with noise. I geuss I should state the problem first. I am trying to get both input and output working on about a 1 foot long straight (four wires untwisted parrallel) serial cable to a PC. it worked ok before when I was just using on line and a ground, but now that I have input and output lines going to the pc, I get noise on the other line everytime I use the serout command from the pic. tried using 10k pulldowns (not being sure about the connection on that I ran 10k from data line to ground and the unused in from the pc as well). that didn't work. then I tried a 10 mf electrolytic on the unused line with neg side going to ground. this worked but it didn't quite seem kosher to be putting a 10mf electrolytic on a line of this sort, especially going to a PC serial line.
is there perhaps a post here with few help hints and some schematics showing how to reduce noise on straight cabling? I been looking for quite some time for some info to glean.
also worth noting, when I ran this pic (16f690).. just on the protoboard with intosc and nothing but power, I got no noise, so it is the parrallel capacitance of those wires doing it. recon I could try some cat5 I have lying around.. would be interested in all things noise reduction however.
I added an xtal btw. specs say +- 1 but in the area of millions of cycles per second, that could be a deal breaker.
thanks for any help. thanks for the help you allready gave me.
Capacitors are the best way to reduce noise. I would guess the unused line is acting like an antenna and the cap is suppressing it.then I tried a 10 mf electrolytic on the unused line with neg side going to ground. this worked but it didn't quite seem kosher
Dave
Always wear safety glasses while programming.
huh.. I tried that electrolytic 10 mf cap. works fine across unused line from the pic. but I started wondering what it might do to the waveform of the incoming pc. I put it accross the pic out, and it went from high/low pulsing to low pulsing. anotherwords the cap is too high. I recon I'm going to have to pull out the old cap box I salvaged some years back and try some various values. I recon its about time to re-stock on the salvaged caps, the goo inside is prolly starting to dry up on the old ones. man.. I sure hope I don't have to find a scope to do this with, that would be a pain in the rear.
gotta hammer away some more and try to find some solutions. I think I am going to replace the wires with twisted pair cat 5 and see what that does.
Hi, Lincoln
Why do you think ICs creators spend their efforts in creating LINE DRIVERS with as little as possible output impedance ???
Good question ... don't you think ?
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks