Notifications
Clear all

Information overload

34 Posts
4 Users
2 Reactions
1,171 Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2542
 

@lhedrick9701 

The easiest way to learn is to look at the examples in the IDE and, if there's something you don't understand, Google it,; something like "Arduino pinMode".

There's very comprehensive documentation for all things Arduino at their website.

https://docs.arduino.cc

Anything seems possible when you don't know what you're talking about.


   
Brian reacted
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @lhedrick9701

(why a program in now called a sketch seems odd)

YES ! I avoided looking at Arduino for, maybe, years because "sketch" cried out "mickey mouse".

How wrong I was.

Will has pointed you at the Arduino docs, which are considerable.

An easy way is google "Arduino Serial.begin". Other search engines are available.

 

>> debug ability, breakpoint, step in/over

Very limited. Serial is a winner:

Serial.begin(11520) - it's fast !

#define Dbug True;

if(Dbug)

     if( x == 0 ) Serial.println("we hit x = 0");

Crude but workable.

 

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@hilldweller Well I do have memory issues now, and I have been away from my workbench for almost 3 months so I may be misremembering. You sound like you know what you are talking about so I will concede, but as soon as I have a chance, I will give it a try.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @will

But, do as you like, it's a free forum

I will, within reason, I'm not here to offend, rather to put something back in. If I'm offering free advice it's on my terms in as much as here is what I offer, which I hope is sound, take it or leave it.

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@lhedrick9701 Start at Arduino.cc. There is lot's of docs there. The Serial class is documented

HERE

I have not looked at the debugger tools in the new IDE (2.x.x) but then I have not encountered a sketch complex enough to need it. 

The language reference manual is HERE

Good luck.

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
(@hilldweller)
Member
Joined: 1 year ago
Posts: 111
 

Posted by: @zander

@hilldweller Well I do have memory issues now,

 

Tell me about it ! It's frightening. I am continually looking up C syntax these days, thank goodness for search engines.

3 months away, I hope whatever the cause you are over it.

 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@hilldweller For debug I use a library that will output to both Serial and MQTT. I then set up my Raspberry Pi 4 to be a MQTT client. I had to do that when I had a project that was powered via the USB port and not connected to my Laptop. Works great, and it's automatic.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@hilldweller The 3 months was for moving. Our cargo trailer was stuck in Winnipeg for most of that time due to the driver buying bad diesel. I just today have got all my stuff moved in but the space is a different shape so the organization has to change. I will be up but crawling by next week, but not fully operational for a few weeks I hope, could be longer depending on my health. I used C enough ending back about 98 but never used or studied C++. Not too much of a handicap as it is only used for libraries mostly and I am learning what I need as I go.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2542
 

Posted by: @lhedrick9701

in a simple sketch (why a program in now called a sketch seems odd)

Perhaps you're looking at it from the wrong angle. By 'program' you mean a set of code that you compile, link together and then send off to the CPU to run.

But the Arduino isn't like that, really. It executes a C++ framework which allows you to add code into an EXISTING module called 'setup()' which allows you to instantiate objects, set initial states and values and allocate any resources you'll need later.

It then allows you to add code into an EXISTING module called 'loop()' which is then called continuously time after time. In this loop your supplied code is executed.

So, really, you're just adding some code to an existing code set - it's not really a 'program' since it's controlled via a means that you never see nor have control over. You're just SKETCHing out a series of initializations and some code to be repeated over and over. You normally have little or no control outside of that scope.

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@lhedrick9701)
Member
Joined: 9 months ago
Posts: 11
Topic starter  

Posted by: @will

Posted by: @lhedrick9701

in a simple sketch (why a program in now called a sketch seems odd)

 

So, really, you're just adding some code to an existing code set - it's not really a 'program' since it's controlled via a means that you never see nor have control over.  

 

Okay, I think I can see what you mean and I guess is doesn't really matter what executable code is called.

 

Another item I forgot to ask.   Am I correct in assuming this in a flat memory fixed address space system, static ram and flash.  No virtual memory or address space.   I don't need a malloc function, I can just create a pointer, load an address and fill a structure using that pointer? 

Are there execution threads available?   Like loop on a connection_request, start a process for that event then continue listening for the next event. 

I have never worked on anything but big multitasking virtual memory based operating systems.  

 

I promise I will stop with the questions, for now anyway until I dig in to stuff for a while.  I'll pickup a board and give it a shot.

Thank you all or your input.

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2542
 

@lhedrick9701 

Yes, you have 2K for variables and 16K or more for programming (depending on Arduino model). I'm sure you can use malloc, although I've never had to on an Arduino. Remember, it's a 'toy' compared to a bare bones laptop. You may find it a challenge to keep your design within the constraints.

Again, you're dealing with a single core (and slow by today's standards) processor. Multi-threading is contra-indicated 🙂 You can, however use timer and pin-based interrupt routines.

You're in for a shock moving from "big multitasking virtual memory based operating systems" down to an Arduino but it's not like you're co-ordinating a warp engine.

What kind of projects are you envisioning (in the long run when you're up to speed). It's possible that you may need to consider using an SBC (single board computer) such as a Raspberry Pi instead of an Arduino.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@lhedrick9701 I, too, spent a few years doing multiprocessor (6) virtual memory event tasking type coding. The facilities you speak of are there, but it varies by family and even board. The real docs are harder to find but doable. You can do what you are talking about at several levels. As always, the closer to the iron you get, the better the performance but, the deeper the cuts and the more blood.

Just google what you are interested in, trying several searches with different words. You will recognize when you have found the docs, for Espressif they have that in the URL, and similarly for Arduino.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 4 years ago
Posts: 7140
 

@lhedrick9701 I forgot to mention. NO, you can't just create a pointer and assign it some random address then write to that location; that will very likely cause a crash. Regardless of the type of memory system, you ALWAYS need to do a malloc or equivalent to guarantee you have proper exclusive ownership of that piece of memory. I am sure you know that I think you asked the question in a way that sounds wrong. Perhaps you want to re-word?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2542
 

Posted by: @lhedrick9701

I promise I will stop with the questions, for now anyway until I dig in to stuff for a while.  I'll pickup a board and give it a shot.

Please don't feel that you have to stop asking questions here.

If you run into anything that you can't find or answer from The Arduino site's documentation or a Google search, then by all means post your question. We are here to help you.

 

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@lhedrick9701)
Member
Joined: 9 months ago
Posts: 11
Topic starter  

Posted by: @zander

@lhedrick9701  you ALWAYS need to do a malloc or equivalent to guarantee you have proper exclusive ownership of that piece of memory. I am sure you know that I think you asked the question in a way that sounds wrong. Perhaps you want to re-word?

 

Having no background with these micro controllers,  I was wondering if they had a flat address space and I might be able to load any address in that space into a pointer.   No matter, you answered the question in that  malloc is the way to do it.  I'm sure I have many misconceptions which I will work through. Thanks. 

 


   
Ron reacted
ReplyQuote
Page 2 / 3