|
Hm, interesting. I thought that chips wanted to keep the environment down as much as possible, and even the Compact Framework is a lot bigger than a C-capable device.
|
|
|
|
|
BobJanova wrote: environment down as much as possible
That is true. But it's a very cheap way for a hobbyist to get into that arena. Which is the market I think that they go after. I know that the processors that we used in my previous life were cheap and all that but oh my lord how they raped you on the price for the programming tools and the interface.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
And countered.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
You've posted your message to C# Forum then ask us "not C#".
Maybe C/C++ forum was more helpful.
Meysam
|
|
|
|
|
|
Fifty years ago I wanted to learn how to make electronic gadgets, too. So I read books - from the library, at first - and I mail ordered parts from the back pages of electronics hobby magazines. I used those parts to build the neat things I found in the magazines. Then I went to school and learned all the math and science I could, so that I could one day understand all that I'd read. After a long, long time I was an electronics engineer, and designed and built with my own hands all sorts of cool electronic gadgets. You can do the same thing, though it's harder now. Everything is digital, and you don't learn anything about electronics doing that trivial stuff. But you can still have fun connecting devices together like kids' blocks and making them do stuff. Although you won't learn much about electronics, for sheer fun I'd suggest that you check out Lego MindStorm kits. These let you build your own robots and program them, which would probably fit better with what you really want to do. Have fun with it!
Will Rogers never met me.
|
|
|
|
|
Just a thought but the Forrest M Mimms III books are a good starting point not too expensive and not too Maths intensive, plus you get to make some really novel things, that more or less how I started
|
|
|
|
|
|
Yes, they don't really go out date, if you do an Amazon search on Getting Started With Electronics it should turn it up (very basic guide) and or The Electronics Pathway by Strickland & Lewis (more formal, structured, serious text book)
Glenn
|
|
|
|
|
Hi,
I don't know anything regarding Modbus in c#.I need some example of Modbus of Client/server to understand about Modbus.plzz Help me.
|
|
|
|
|
|
I don't understand this open aorta. I need a youtube-video showing me how to sow the sucker up. Plzz, help me.
I know it's rude, but it's pissing me off. I'll be taking a break from the CodeProject until I have learnt to ignore these kinds of posts.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: I'll be taking a break
Good luck with that. Perhaps we need a Dealing With urgentz codez Support Group.... Come back when you feel better.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
I'm assuming it's urgent?!
|
|
|
|
|
SMACK
there that should make you feel better
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Be happy that you don't know anything about it! It's old , a pain and a mess to work with.
My tip is: Ignore it and find better bus system to work with. Preferred a object oriented instead of register based.
|
|
|
|
|
Did you know that Code Project has a whole series of articles on a wide variety of topics? Funnily enough, someone already wrote an article about Modbus - you can find it here[^].
|
|
|
|
|
I'm not sure what I've gone wrong. It works ok in same namespace but not in different namespace. I use the dll calling to pass the enum value.
The compiler spat out 2 errors:
Error 1: The best overloaded method match for 'junkie.NewClass1.TestMethod(junkie.Output_State)' has some invalid arguments
Error 2: Argument 1: cannot convert from 'junk.Output_State' to 'junkie.Output_State'
sample code that I've written:
using junkie;
namespace junk
{
public enum Output_State
{
OFF,
ON,
Dont_Care,
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
ClassTwo testClassTwo = new ClassTwo();
testClassTwo.TestMethod(Output_State.Dont_Care);
}
}
public class ClassTwo
{
junkie.NewClass1 testClassThree = new junkie.NewClass1();
public void TestMethod(Output_State output)
{
testClassThree.TestMethod(output);
}
}
}
in a new class file:
namespace junkie
{
public enum Output_State
{
OFF,
ON,
Dont_Care,
}
class NewClass1
{
public void TestMethod(Output_State output)
{
switch (output)
{
case Output_State.ON: MessageBox.Show("ON"); break;
case Output_State.OFF: MessageBox.Show("OFF"); break;
case Output_State.Dont_Care: MessageBox.Show("Don't Care"); break;
default: MessageBox.Show("HUH?"); break;
}
}
}
}
|
|
|
|
|
The reason you are having a problem is because these aren't the same enums. By that, I mean that you have actually declared two enums here - the fact that they have the same names means nothing. What you need to do is drop the enum from the junkie namespace, and then add a simple using junk; statement to junkie. It will look like this:
namespace junkie
{
using junk;
public class NewClass1
{
public void TestMethod(Output_State output)
{
}
}
} The using statement means that the junk.Output_State enumeration is used.
|
|
|
|
|
that what you suggested is good... but I think I would use the better way is to drop the enum in 'junk' namespace and reads as follows (no change in 2nd class file):
using junkie;
namespace junk
{
public partial class Form1 : Form
{
SerialPort _port;
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
ClassTwo testClassTwo = new ClassTwo();
testClassTwo.TestMethod(junkie.Output_State.Dont_Care);
}
}
public class ClassTwo
{
junkie.NewClass1 testClassThree = new junkie.NewClass1();
public void TestMethod(junkie.Output_State output)
{
testClassThree.TestMethod(output);
}
}
}
<pre>
Thanks for a big help... I've learned something new.
modified 23-Aug-12 8:59am.
|
|
|
|
|
junk.Output_State and junkie.Output_State are two different types, even though they appear identical in all other respects.
|
|
|
|
|
If these enums are not going to change over time and they are similar, I suggest you to have it in a common namespace and access it in both places.
like,
namespace Common
{
public enum Output_State
{
OFF,
ON,
Dont_Care,
}
}
namespace junk
{
using junkie;
using Common;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
ClassTwo testClassTwo = new ClassTwo();
testClassTwo.TestMethod(Output_State.Dont_Care);
}
}
public class ClassTwo
{
junkie.NewClass1 testClassThree = new junkie.NewClass1();
public void TestMethod(Output_State output)
{
testClassThree.TestMethod(output);
}
}
}
namespace junkie
{
using Common;
class NewClass1
{
public void TestMethod(Output_State output)
{
switch (output)
{
case Output_State.ON: MessageBox.Show("ON"); break;
case Output_State.OFF: MessageBox.Show("OFF"); break;
case Output_State.Dont_Care: MessageBox.Show("Don't Care"); break;
default: MessageBox.Show("HUH?"); break;
}
}
}
}
|
|
|
|
|
Hmm... I like the suggestion you've made. I'll look into that in the future revision. Thanks!
|
|
|
|
|
I have a Windows service which I sometimes cannot properly stop. Sometimes I get "Error 1053". Error 1053 is an error when a time-out has elapsed for starting and stopping services. Simple terms: It takes to long to start or stop a service.
By trial and error I have found out, on my computer, that it takes about 2 minutes and 10 seconds for the error to occur. 2 min and 5 sec is fine.
When I'm trying to stop the service the service might be in a process to read and export data. This process maybe takes some seconds or maybe a minutes to complete. I can never tell how long time the procedure takes.
I would like to finish the process and then stop the service. But since it can take up to minutes to finish the process I'm sure I'll spend to much time in the OnStop() method.
I have tried the Service.RequestAdditionalTime() method to give the service more time to wait so my process can finish. But "Error 1053" still occur for me.
I have tried with 10 ms and 1000ms. No success!
My code is basically this, very simplified:
using System;
using System.ServiceProcess;
using System.Threading;
public class Application
{
public bool running = true;
public bool terminated = false;
public void MainLoop()
{
while(running)
{
ReadData();
ExportData();
}
terminated = true;
}
private void ReadData()
{
}
private void ExportData()
{
}
}
public partial class Service: ServiceBase
{
Application application;
public Service()
{
InitializeComponent();
}
public OnStart()
{
this.application = new Application();
Thread mainLoopThread = new Thread(application.MainLoop);
mainLoopThread.Start();
}
public OnStop()
{
applicaiton.running = false;
while(application.terminated == false)
{
this.RequestAdditionalTime(1000);
}
}
}
Let's assume the Application.ReadData() method takes 3 minutes to complete. Much longer than the OnStop() method is allowed to run.
How can make OnStop() method accept longer time to wait?
|
|
|
|
|
Mc_Topaz wrote: How can make OnStop() method accept longer time to wait?
AFAIK, controlled by Windows, not by code.
Why not simply use a normal executable with a (background) thread? One that polls whether the user cancelled the action?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|