contemplating changing code language

Status
Not open for further replies.

MrDEB

Well-Known Member
Have kinda got a handle on Swordfish but feel I missed alot by not using perhaps ASM or C or Picbasic.
First most of my projects don't require the 18F chips so why spend the bucks?
Have two books One is PIC IN PRACTICE by D W Smith
The other is PICBASIC PROJECTS by Dogan Ibrahim
two different languages.
Then I get Emails about a C coarse which looks enticing but the coarse is $70. Good deal but the debate that is older than dirt which is best? language or easiest learning curve.
Like I said before I feel I missed the boat starting with swordfish. I feel kinda lost. Getting a good understanding of how code is supposed to work.
lan to start from scratch basically. Have several DIY development boards but contemplating combining the boards that Nigel has on his website into one board.
And then a compiler. I assume if I go with most any language I can still use mplab?
 
ASM is not as difficult as people make it out to be. I actually PIC'ed it up (pun intended) before I ever picked up embedded C.

The thing with asm is that you get to go deep into the hardware and learn EVERYTHING about what is happening on the chip. A big advantage to asm is that you can also write really tight code with it, making a program that is feature packed without taking up lots of code space on the chip.

I got started in embedded electronics in late 2010. ASM is my preferred language and after a year and a half into it I can now cross migrate between Microchip and Intel assembly. If you ever decide to learn Microchip ASM feel free to ask and I'd be more than willing to show you the ropes.
 
Then I get Emails about a C coarse which looks enticing but the coarse is $70. Good deal but the debate that is older than dirt which is best?

Don't pay for a course that is spammed to you via email. Spend your money on a good boog.. even better, the internet is full of good tutorials on any language. If you don't know what language to choose.. try both C and ASM. Learning more than one language is not a waste of time. Choosing between C and BASIC is quite irrelevant on my opinion. Choosing between C and ASM depends on the project you are working on.. so it is good to know both. If you decide to learn ASM, then I would definitely choose C over BASIC as the second language (because of the possibility to do inline ASM). In general, C and ASM is a very strong combination.
 
Last edited:
Then I get Emails about a C coarse which looks enticing but the coarse is $70. ?

Don't spend money on C courses, use Google and search "C tutorial" you will get a large amount of hits for FREE stuff, Though you would really need to buy a reference manual for C, 1 example would be K&R
 
C over BASIC simply due to C being far more prevalent in microcontrollers. It sounds like you're not doing anything all that advanced at the moment, but there are a lot of C libraries available and you can steal a lot of libraries from other microcontrollers for more advanced processing like FAT libraries, Graphic LCD libraries, RF libraries... C or BASIC matters a lot less if you will never need to use anything like this.

ASM is nice to get a handle on first.

As mentioned, you can go through free C tutorials. No need for a course which may or may not go at the pace you need.
 
hmmm interesting posistion to be in. i have a little less experiance than you but not by that much. i tried swordfish at the begining of my journey in electronics but didnt get into it mainly i think because of the limits for the free version. then the guy that developed it went missing for 18 months and kind of left everyone that had paid for it out on a limb. personaly i cant see the point switching from swordfish to picbasic if anything i get the impression swordfish is the better compiler???
as for C V's ASM debate i would recomend for someone in your posistion to go for C the old debate about you get to know more about the hardware i ASM i dont think holds water, yes you can use alot of built in libs from most compilers that hide a great deal of the inner workings but there is nothing that says you cant delve deep into the datasheet and CODE in C twitching individual bits of a register there are times i prefer to do this. the advantage of C is you get the option to go as deep as you want/are able to. you can and very often do use inline ASM inside a C program so the tight code thing is a bit missleading. also consider this..... the effeciancy of a program has way more to do with the programmer than it does with the compiler/assembler he is using. look at some the code on this site from the likes of pommie/3v0 tight fast and does the job.
as to wich compiler to use i would normaly jump right in and say C18 like i use as its well supported on this site. but to get a wide coverage i would recomend starting with Hi tech C. whatever you do dont pay for a course online it's a total waste of money there is NOTHING you can get in a paid for cvourse that you cant get for free with a little bit of googling.
hope this helps
 
Is Swordfish holding you back or is it a lack of understanding command formats?

Basic is pretty much Basic. Swordfish, PBP and even Proton are more alike than different, with only minor format differences between commands. Remember, Basic is an acronym for Beginner's All-purpose Symbolic Instruction Code. I wouldn't place too much emphasis on "Beginner" as today's Basic languages are extremely powerful and won't limit the applications except in extreme cases.

If you're having trouble with the syntax and command format in Basic, C will bring new dimensions to your headaches. Seemingly minor format changes will drastically impact program operation. Yes, C is a standard but no, all implementations are not the same. I think you'll find the differences are more subtle than the differences between Basic dialects, and more difficult to figure out.

From what I've seen here, you really don't stand a chance with assembler. I may be wrong, but I don't think that someone who thinks that there is a value between the integer numbers 1 and 2 will be able to follow along.

And why combine Nigel's boards? Why not learn the lessons that each will teach you rather than making life complicated? As I recall, you had some major difficulties making your Junebug board work because of all the switch combinations.
 
You can do inline ASM with PicBasic too

Oh, thanks for the info. I did couple of google searches and didn't find any articles about inline ASM in BASIC programs.. so I just assumed that there is no such thing (sorry for that). To be honest, the idea that somebody uses BASIC and does inline ASM is very strange to me. Is this something that only PicBasic supports, or can you do inline ASM in BASIC programs in general?

I would also like to note that there is a dedicated thread for https://www.electro-tech-online.com/threads/computer-language-discussion-pic-programmers.126725/.. if somebody wants to debate about "what language is the best".
 
Last edited:
as for C V's ASM debate i would recomend for someone in your posistion to go for C the old debate about you get to know more about the hardware i ASM i dont think holds water,

Not to sound condescending but if I'm not mistaken...weren't you mainly using Flowcode up until recently?

Have you ever written a functional program in assembly (simple "flash the LED" programs don't count)?

Also, wasn't it you who admitted to copying others' code routines that performed the functions you wanted rather than coding up your own?
 
Last edited:
Some observations.

Basic SwordFish and C are all procedural languages. Anyone who can do a good job programming in any of these should not have much problems transitioning to one of the others. By the same token if you are having problems with any of them switching is not the answer.

If you are having problems with swordfish I would not suggest going to ASM.

I am thinking you overstated the price difference between 16F and 18F PICs.

Just checked newark and see the IP versions of the 16F88 for $2.60 and the 18F1320 for $2.69. They both have 4K words of flash, yes I am ignoring word size, but the 18F is twice as fast.

The price of PICs seem to have as much to do with how many are being sold as the feature set. Also it seems the more modern PICs are priced to competitive with the best the competition has to offer and this can make them better buys.
 
All Basic that's for the pic microchip can use ASM this is from Swordfish
Pic basic Pro. can use it PBP can Greatcow can
 
Assembly Is not that hard if you read the datasheet, But Flow is some times hard to under stand. There really no free lunch here. You can use basic with the smaller pic chips but you'll have to buy the compiler to use the newer chips. Mrdeb I don't want to sound smart but if I was you I would learn Nigels tutorials if you want to learn ASM and use his boards. You don't want to spend months figuring out why code is not working only to find you made your board wrong.

It's like this if you owned the whole world where would you put it? Learn to do one thing first then go and make your own boards, or make a all in one board.
See Nigel did the hard part he make boards that work if there not working you made yours wrong period. He wrote code that runs on his boards And yes it works the LCD will show what the code has in it to display. The Led's blink the Uart sends data and Yes all his code works just as he planned it period.

Some may want to think that he made a mistake he didn't the set work as he planned it They all work. So make a set that works learn how to use code that works. That will save you some years of work when you get back to doing the things you want to do.

Or if this sounds like to much work then use PIC Basic Pro there code all over the net that can do almost any thing you could dream up for it. And spend lots of time making boards and figuring how to use the code you find on the net.
 
ERMMMMMMMMMmmmmmmmmm NO! ive never used flow code!! yes i have borrowed bits of code (i assumed most have) no ive never used ASM i prefer to use C my own personal choice
 
In for a penny........ ASM is really the choice if you are working with limited resources...ie 1k rom, hardly any peripherals etc... But! as you start to program a PIC24 with 32k, 64k or even 128k for memory space, ASM gets harder to keep track of....

We have a H8/500 with 64k rom the program takes up just over half.. the rest is taken up by tables and variables.... 32k of ASM is... well overwhelming!!! The code is well commented but very difficult to keep tabs on (It was written by an ex director, and he's long gone)...

IF it had been written in 'C' we would have a far easier job. I still believe that ASM really should be learnt, but larger programs are far easier to manage in C or another high level language.

I can optimise C pretty well... however there is always need for a bit of ASM...

If I was taking up programming I would focus on C and chuck some inline ASM stuff in... There are many here that do C on one platform or another, and there are many more that can help you with ASM should you need...

That said..... I've seen code in ASM on this site, using macro's.... It can be misinterpreted as a high level language..... It was very good... almost basic like...
 
ERMMMMMMMMMmmmmmmmmm NO! ive never used flow code!! yes i have borrowed bits of code (i assumed most have) no ive never used ASM i prefer to use C my own personal choice

OK...my mistake on the Flowcode. However, you've never coded in ASM once, which means you know little to nothing about it, yet somehow you feel that my statement of "knowing ASM allows you to learn the uC hardware on a deeper level" doesn't hold water???

Allow me to let you in on a little secret. Learning the uC hardware on a much deeper level is a REQUIREMENT in order for assembly coding to make any sense! Probably why assembly never made any sense to you.

My point...you may want to refrain from trying to discredit others with your ill-formed opinions on things you know next to nothing about.
 
Last edited:
calm down jon your gettinbg yourself in a twist over nothing. i never mentioned you i certainly didnt argue the point that to understand ASM you need to get into the hardware. what i DID say and stand by is you dont have to the ASM route if you want to get deep into the datasheets and hardware you can also do that in C. dont try and start something with me for no reason. be as condescending as you like to me tho
 
I'm surprised Nigel hasn't popped in yet?
First on my list, build the boards that Nigel has on his website. While I have several for the 40pin pics, none for the 8 ,16, 18 pin chips. 16pin??
 
I'm surprised Nigel hasn't popped in yet?
First on my list, build the boards that Nigel has on his website. While I have several for the 40pin pics, none for the 8 ,16, 18 pin chips. 16pin??

why are you giving up on swordfish? or is it more a case that you want to learn something else as well? i can understand choosing nigels site as he has the hardware as well but are you aware that microchip publish the schematics for there dev boards as well? so if you wanted to go down the C route there is alot of code in C18 that was written for there own Dev boards even things like USB and Cap touch (mtouch as microchip call it). i cant help thinking that if you started with Basic then C is a more natural progression, i have nothing against ASM personaly ive just never needed to go that route. as for chip choice i always thought you used 18f's?
 

I am not familiar with other Basic programs, I have only used it for interrupts in my code.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…