|
I use "SerialPort3.BreakState", to manage making a flashing led. On pin 4 or 7 the this property is not good at all(I have done the test right now).
|
|
|
|
|
how to activate the pin 4 or 7 from rs232, to be able to use the properties and methods from SerialPort control?
|
|
|
|
|
here is the pin explanation and from what I see the 4&7 have
RTS & DTR are binary outputs that can be manually set and held
4 DTR (Data Terminal Ready) Output
7 RTS (Request To Send) Output
http://www.aggsoft.com/rs232-pinout-cable/images/9-pinout.gif
how can I manually set those outputs?
.
modified on Thursday, August 6, 2009 6:51 AM
|
|
|
|
|
if you want to use a class, read its documentation. So go read about SerialPort class. It is all available in MSDN.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
See SerialPort.RTSEnable and SerialPort.DTREnable
MSDN SerialPort[^]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
thank you v much. Now indeed is blinking on pin 7 with command property RtsEnable. very nice.
But now I want to make a matrix of LEDs, dancing.
What I should use? a Demultiplexer CI? I have a 74159 Demultiplexer.In theory it should work + a ULN 2003. It is a easy another way? I need advice.
The Idea is like this: How can I ramify the number of pins to send data to (let's say 80 led's, or 15 steppers(5wire)) a lot of pins and the fv at that I can send the bit information not to be minimize dramatically?
thanks.
|
|
|
|
|
Glad to hear it works!
I'm not a hardware engineer - but I have worked with H/W designers for long enough to have a good idea what they are talking about, so here goes:
Running a large number of LEDs is going to be a problem. Several in fact:
1) Each LED consumes power, and the serial port is not going to give you too much of that! That is one of the reasons USB was designed - it provides 500mA, loads more than RS232. You will need external power very soon, or you will risk damaging your PC. Each LED consumes from 20mA on up, so just 25 is the limit for USB!
2) A 74159 is not realy going to work: it uses four inputs to drive one of 16 outputs. If you want to drive lots of outputs, why not look at putting a PIC or similar in there, and interfacing it to the serial port as a serial port? You can then provide the external power from a main adapter or battery, and do what you like with the LEDs. You would also get an introduction to the wonderful world of microcontrollers! And probably, assembler, though C is available for PICs. It is a lot more flexible that way!
3) You would need to look at MAX232 or similar chip to do the +12/-12V RS232 to +5V logic of ICs whatever you use, or the ICs are all going to die very quickly...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
yes the plan is like you said .
I have already a PIC18F4550 PDIP and I intend to program it (maybe some insights on what testing board I should use? the best that there is ) and the cheap one + the ability of programming with it the older pic 16f84 that I have in stock also;but not necessary.
But my concern is after I program the pic (the18f one) and I have 40 inputs to fill in from the Led matrix, + the external source (an atx will suffice) how I can fill the gap between pic and those 40 inputs? I need something that I can use to fulfill the 40 outputs, no?
or the better way, without pic , I wish to command DIRECT from serial port, to be able to play a little with that matrix and after I am satisfied with the pattern I like THEN I will write it into the pic and use it like a stand alone product.
thanks.
|
|
|
|
|
I can't help you with testing boards (I used breadboard for little tests and "proper" PCB for bigger things, as I had H/W designers available to steal bits from)
I think your best bet at this point is to start looking at PIC tutorials - Google will find plenty - and working from there, or my advice will probably start introducing problems such as lack of de-couplers, wrong resistor values, etc. PIC experts will be able to help you better I think. It's a good processor range, though.
But, in overview, I would have something like this:
PC communicates to your PCB via RS232
PCB has external power supply
PCB interfaces to PC via MAX232
MAX interfaces to PIC via TTL
PIC interfaces to LEDs via buffer IC from the vast 74xxx range
The PIC software can be told to turn on /of LED individually as required. When you have a pattern you like, programm it directly into the PIC.
Don't forget the buffer chips, to reduce the power loading on the PIC and (potentially) expand the number of driven LED's as required.
Strongly suggest you socket everything on the PCB as it is a lot easer to change than cutting dead chips out and fitting new ones!
Good luck - let me know how it goes!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
well i have a textfile that has a bunch of usernames and passwords in them.
they are in this format:
username:password
username2:password2
username3:password3
etc.
now i want to put each of these into a listview, with each login being on a new row.
for example username is in listview1.subitems[0] and the password is in listview1.subitems[1].
then the next account is the same, but on a new line.
im not too sure in how to do this.
i can only seem to get one of the accounts to go into it.
i want each on a new row.
|
|
|
|
|
StreamReader sr = new StreamReader("File.txt");
string line = sr.ReadLine();
while(line != null)//loop through each line until end of file
{
if(line.Contains(":"))
{
string[] parts = line.Split(':');//you may want to validate unless your certain the input is perfect
//now parts will contain username at index[0] and password at index[1]
//so you can add both to a new line in your listview
}
line = sr.ReadLine();//read in the next line, without you will be in endless loop
}
sr.Close();
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi all,
I'm using multiple check boxes. Now i need is to store the multi selected checkbox in a single field of table. Help me with sample code plz.
thanks in advance...
Elizabeth..........
|
|
|
|
|
Not a chance, this is a really bad data design. Store each checkbox result in it's own field. If not your next post will be how to get multiple values from 1 field, and the one after would be how to query that field.
DON'T DO IT.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i know its bad data but i need it....
|
|
|
|
|
No you need to change your data design, if it is not your decision you need to go argue with whoever has made the decision. You do should not conform to this design unless you can ABSOLUTELY guarantee that the data will NEVER, ever be used. If this is the case then why are you storing the data.
What possible valid reason could you have for storing data in this style.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I agree you should never do this. Though it can be done as I also have posted on a other reply. You really should only do it as a last resort...
Fight tooth and nail, try not to do it.
|
|
|
|
|
Well, here's[^] one very valid situation - I've seen this used in numerous event management systems, and it's a good way to keep recurring sequences in a reasonable amount of memory.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Well Pete ya got me there, I may even have a use for it in a current requirement. However I got an excellent laugh when looking at that artcle and trying to equate it to this post. I will modify my statement to 99% of the time this is just plain wrong.
Additionally the support costs downstream for this type of data storage is going to be extreme. Try explaining that article to a junior support developer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I must admit, it was the only case I could think of where it was justified (and I racked my brain for maybe 20 seconds).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
It really all depends on several things but this should be the simplest way of breaking it down.
You would have to first order the check boxes with a system.
Example:
checkbox 1
checkbox 2
checkbox 3 checkbox 4
checkbox 5
checkbox 6
checkbox 7 checkbox 8
So as you see first you would have to visually see an order for the checkboxes.
This order can not change when you go thru your logic.
Next you return back to the good ole days and still used binary standard.
for each box in sequence you assign a 1 or a 0 to based off of if they are checked or not.
Now you parse your string accordingly to read each checkboxes value and you combine each check boxes value when writing the string to the sql server.
example (Continue):
Checkbox 1 = checked
Checkbox 2 = not checked
Checkbox 3 = checked
Checkbox 4 = checked
Checkbox 5 = not checked
Checkbox 6 = checked
Checkbox 7 = checked
Checkbox 8 = checked
Using the standard of 1 = Checked and 0 = Not Checked
you would have something like this to store the value to sql server:
string sqlvalueforfield = checkbox1.checked.tostring()+checkbox2.checked.tostring()+checkbox3.checked.tostring()+checkbox4.checked.tostring()+checkbox5.checked.tostring()+checkbox6.checked.tostring()+checkbox7.checked.tostring()+checkbox8.checked.tostring()
then to retrieve the value back to the form
checkbox3.checked = Cint(sqlvalueforfield.Substring(3,1))
let me know if this helps....
|
|
|
|
|
Hey you beat me to the punch
var question = (_2b || !(_2b));
|
|
|
|
|
YEA I win. now if I could get help on my issue of retreiving a image from sql server....
but anyway... PLEASE Understand Really bad idea.
|
|
|
|
|
While technically possible, this is a REALLY bad idea.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Provided, your checkboxlist always looks the same, i.e. it has the same number of checkboxes and they are indexed the same way, if you use a varchar field to store a string of numbers, something like "101100101",
you can then use a stringbuilder to create your string iterating through the collection of your checkboxes.
If the checkbox is checked, set the value to one and zero if it's unchecked.
I do agree that this is not the greatest of designs, but it might just make do.
Another way to do it would be to use an Xml field (provided your using Sql Server), and store the values in there.
var question = (_2b || !(_2b));
|
|
|
|
|
I have done this in the past and I don't see anything wrong with it provided the data values are directly related to one another.
[Serializable(), Flags()]
public enum DayBitFlag
{
None = 0,
Sunday = 1,
Monday = 2,
Tuesday = 4,
Wednesday = 8,
Thursday = 16,
Friday = 32,
Saturday = 64
}
Then create a class that inherits CheckBox, something like this:
public class DayCheckBox : CheckBox
{
private DayBitFlag _dayValue;
public DayBitFlag DayValue
{
get { return _dayValue; }
set { _dayValue = value; }
}
}
I am sure you can work the rest out from here.
Adam
|
|
|
|