Maker Pro
Maker Pro

i want to learn to code but.....

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
The programming language is not my weak link either. It's reading Datasheet - a terrible language for beginners.

And all datasheets seem to be written by the same guy. He does not get my vote for a Pulitzer Prize. He uses abbreviations like Vcc, Vss and "weak internal pullup" which I don't use at the dinner table. The man seems to write it as if he were late for something (maybe writing the next datasheet), cramming as much info on one page as he can get, without so much as one attempt at humor or explanation.

There is a difference between a datasheet and what is called a 'reference manual' on a more complex part. Today many companies combine the two and leave out a lot of information needed for the programmer. If it is included, it is put into a complete different chapter than the one it should be. It really was better before, with a lot of application examples included.

The syntax of a datasheet is more or less standard for all manufacturers, and most of the information given there is good. You need to read a number of them to get the training to get all the points. Remember to read the fine print too. ;)
One thing that most newbes do wrong is to interpret all the max limits as they are written. This is not how things work.
The max limits are listed without dependence of each other, so you can't max voltage and current at the same time without looking at the power used, as an example.

There is little humor in the datasheets, and there is no need for it either. You'll get all the fun you'll need when you get your gizmo working, after nights pouring through pages of datasheets and code you've written, hunting for the bug hiding there.
I've been there, and there is absolutely no need for funny comments at 5am in the morning. :D

TOK ;)
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I learned assembler on a DEC-10. Then on a 6502, then a PDP-11, then an 8088, then I looked at 68xxx assembler. PIC assembler still looks like chicken scratching to me :eek:
I learned assembler on the Apple 2e at school, 6502-based. Then Z80 on a ZX81. I wrote a disassembler in ZX81 BASIC! I wanted to disassemble the ROM and analyse it, but I didn't have a printer or any way to annotate the disassembly as a text file. Then I learned assembler on the 8088 under MS-DOS. I've also written assembler for 6303, 8051, AVR and MSP430 at my (former) job.

IMO, out of those, only the Z80, x86 and MSP430 are really powerful enough to use standard (or relatively standard) C. There are cut-down C implementations for the 8051 and others.

We (at my job) considered the PIC but no one liked the architecture, and I agree that PIC assembly code looks pretty abstruse.
 

foTONICS

Sep 30, 2011
332
Joined
Sep 30, 2011
Messages
332
and I agree that PIC assembly code looks pretty abstruse.

the only assembly I know of is on the PIC from the gooligum website. Is there a similar tutorial website that I could use for other micro's? I wouldnt mind being fluent in a couple different languages, it may be the only thing that separates me from the other degrees come graduation time (T-minus 1 year)
 

foTONICS

Sep 30, 2011
332
Joined
Sep 30, 2011
Messages
332
I took visual basics .net, and I checked out a self-taught C++ book. At my school they currently teach electronic students in C and Unix (I believe it's called unix, im a semester behind and havent taken it yet)

so I guess I could say I know C,C++, unix, .NET (vaguely), and assembly

would that list be worthy of stamping on my resume?
 

donkey

Feb 26, 2011
1,301
Joined
Feb 26, 2011
Messages
1,301
don't put things on your resume unless you are confident with them. If you put it on your resume and are asked to do it and you can't then it looks bad, real bad in some cases.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
You could say "Some small exposure to..."
 

wingnut

Aug 9, 2012
255
Joined
Aug 9, 2012
Messages
255
You could say "Some small exposure to..."

One language which I have "some small exposure to" was Ruby. What a pleasant experience that was.

It is a perfect language to search for and to replace words or phrases. I wrote a program to translate the Bible from Hebrew (using Strongs numbers) into English. My algorithm was that each Hebrew word has a most popular way that it is translated into English (and then minor ways). I made it choose the most popular way in every case. It left all the smaller words (prepositions and conjunctions etc.) as they were in the King James.

In about one page of Ruby I had my own unique and quite insightful translation of the Bible. I saved this on my website about 8 years ago. Since then the website died.
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
And all datasheets seem to be written by the same guy. He does not get my vote for a Pulitzer Prize. He uses abbreviations like Vcc, Vss and "weak internal pullup" which I don't use at the dinner table. The man seems to write it as if he were late for something (maybe writing the next datasheet), cramming as much info on one page as he can get, without so much as one attempt at humor or explanation. Reminds me of some of my teachers. When they fire him one of these days, I am going to apply for the job of Datasheet Writer.

I love Microchips datasheets they go into great detail and provide a wealth of information... If you want a headache get some obscure chips with a 'Chinglish' translated datasheet, that is all of one or two paragraphs when it needs to be 5 pages...

I just recently was inquiring about the source/sink capabilities of an obscure LED matrix driver chip... They had example circuits for 'low', 'med' and 'high' current LED applications... They never bothered to give any actual figures of what low, med and high values were... And they failed to give overall sink/source of the chip... I dropped them an email and instead of giving me values for low, med and high they insisted I give them my LED specifics and how many LEDs I was driving... And then returned with an email stating that the med or high example would be best for my design... I again tried to milk an actual number from them but they just kept repeating that I use the med/high example circuit... BTW the difference in the example circuits was either direct drive of LED aka low, med was a transistor on the source side and direct sink and high example was a transistor on both the sink and source side... I still would love to know what the direct sink/source capacity is, but I guess it's a secret :)
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
... I still would love to know what the direct sink/source capacity is, but I guess it's a secret :)

Offer them to sign a NDA, at least if you represent some type of company. I've had to do that some times, to get detailed data.

Such limitations on product data does not increase the number of users of that chip, since you as a designer is responsible to get approvals on the end product. Doing that blind is like playing Russian roulette.

TOK ;)
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
There is little humor in the datasheets
Sometimes there is, see attachment (o.k., that was 1972 - is this possible today?). I attached only the first page of the datasheet. Fun enough.

For more details read this on page 14 ff. (caution: ~20MB!). I recommend downloading the full document and storing it on your harddisk. It is useful and funny but at 338 pages a bit hard to swallow in one piece. Makes good reading for those times when you don't know what to do (or don't want to do what you have to :))
 

Attachments

  • WOM_small.pdf
    74.6 KB · Views: 166
Last edited:

wingnut

Aug 9, 2012
255
Joined
Aug 9, 2012
Messages
255
Sometimes there is, see attachment (o.k., that was 1972 - is this possible today?). I attached only the first page of the datasheet. Fun enough)

Ahh - the 70's I remember them well. They were just inventing electronics (I miss my Denshi blocks). That datasheet (first page) had a 70's zaniness and the fuzzy logic of a pot smoker.
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Offer them to sign a NDA, at least if you represent some type of company. I've had to do that some times, to get detailed data.

Rather than pull teeth I'm going to simply build it for high use, then I can tailor the external transistors to my loads and not worry about it... I would of course loved to be able to skip them and direct drive but they at least provided me enough info to know that the chip won't support that...

On that same note another irregularly I have come across with datasheets, is when I could only find a Chinese version of the datasheet so I translate it with an online translator while I wait for the company to send me the English version... To my surprise when the English version was emailed to me, it was a condensed version that only contained the nitty-gritty info... It lacked things like all the example circuits and even example 'C' code to interface to said chip... Thus making me glad I had the poorly translated Chinese one originally as it was much more detailed...
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
Sometimes there is, see attachment (o.k., that was 1972 - is this possible today?). I attached only the first page of the datasheet. Fun enough.

And, as far as I remember, it was released on april 1st. :D

TOK ;)
 

wingnut

Aug 9, 2012
255
Joined
Aug 9, 2012
Messages
255
Inspired by this thread, I decided to give the PIC comparator another go, and with16 lines of MikroBasic managed to accomplish what before had seemed out of reach. MicroBasic is great (thanks CocaCola). I now have a PIC powered solar tracker. Thanks for the inspiration. It was not all the PIC and Datasheet's fault.
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Inspired by this thread, I decided to give the PIC comparator another go, and with16 lines of MikroBasic managed to accomplish what before had seemed out of reach. MicroBasic is great (thanks CocaCola). I now have a PIC powered solar tracker. Thanks for the inspiration. It was not all the PIC and Datasheet's fault.

Glad to hear it worked, a decent BASIC compiler can make a huge difference for the newbie in development time... It's the reason I still use BASIC I can develop faster without worrying about the little things...

I also highly recommend the Mikroe developer boards, they are worth every penny IMO...
 

milesdavidsmith

Aug 28, 2012
7
Joined
Aug 28, 2012
Messages
7
Hands down, the BEST language for beginners is Python, then come a more C-like language like Perl, PHP, or Java (or C).

I think C++ gets too much credit these days. It's really a piece of ****, and everyone knows it. Unfortunately if you're a professional you still have to learn it, but as a hobbyist it's avoidable. And of course, for MCU coding you will need to at least know C, but you will be programming decently in C if you start off with a nice language like Python (because C++ and C don't lend themselves well to learning programming concepts).
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
And of course, for MCU coding you will need to at least know C

You don't have to learn any C, it's simply the most popular and cross platform flexible, it's 100% avoidable if you chose, in both micros and computer programming...
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
Hands down, the BEST language for beginners is Python, then come a more C-like language like Perl, PHP, or Java (or C).

I think C++ gets too much credit these days. It's really a piece of ****, and everyone knows it. Unfortunately if you're a professional you still have to learn it, but as a hobbyist it's avoidable. And of course, for MCU coding you will need to at least know C, but you will be programming decently in C if you start off with a nice language like Python (because C++ and C don't lend themselves well to learning programming concepts).

Well, I've never seen Python or Perl for PIC compilers, but you never know.

There is a world of hardware in difference between a DIY embedded program on a microcontroller, and some application programs on a PC.
C would be my choice for microprocessor and -controller programming, lightly sprinkled with assembler for the tight spots.
The only reason to choose C, is that this is a general language for all microcontroller families. The more esoteric compiler variants may only be available for a small number of microfamilies. Selecting a 'strange' language will reduce your range of possible microprocessors when you select your hardware.

Whatever you do, learn and understand the hardware and the interaction with it, and your programming life is so much better.

TOK ;)
 
Last edited:

mincior

Aug 14, 2012
13
Joined
Aug 14, 2012
Messages
13
Algorithm Builder - free Atmel platform

To be perfectly frank, C is a pain in the bum, and C++ is a bigger pain.

Neither are languages for beginners. People who say they are are either not programmers, or have not been exposed to a wide range of languages. There is so much you can do wrong and even the best compilers can't (or won't) catch it. It can lead to very poor practices.

For beginners I wish I could advise something better.

However, commercially, C is the go.

I would recommend that you find a skilled programmer to review what you write. They will understand where you've made subtle mistakes or done things in a way that is fragile or prone to unexpected failure.

Assembler is an even bigger pain again. Leave that alone for a while.

Did you try Algorithm Builder? Is my favorite and it is free : http://algrom.net/. It has debugger, programmer. It is a complete visual tool platform.
 
Top