Author Topic: Help with PIC / ASSEMBLY for a project from a book  (Read 2980 times)

0 Members and 1 Guest are viewing this topic.

Offline ZybyyyTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Help with PIC / ASSEMBLY for a project from a book
« on: February 19, 2019, 10:47:12 pm »
Hello everyone,

I am new to the world of PIC programming. I bought a book "PIC in Practice" by D W Smith 1st edition
While trying to recreate the task 1 there are some problems I can not sole for the past 3 days. I really want to progress and carry on being better however at this stage I do not understand enough to solve it.
Program says that the LED supposed to blink - I can not make this LED to blink, basically nothing happens. I do not know why ???
So, the language is ASSEMBLY, I use PICkit 2, and MPLAB X 5.10, I tried this on 16F84 and 16F628A, 2-3 each. I use MPLAB breadboard.

I have attached schematics for this.

Programm from the book tells me:


; Header84.ASM for 16F84.   This sets PORTA as an INPUT(NB 1
;                 means input) and PORTB as an OUTPUT
;                 (NB 0 means output). The OPTION
;            register is set to /256 to give timing pulses
;                 of 1/32 of a second.
;                 1 second and 0.5 second delays are
;                 included in the subroutine section.
   
;*****************************************************************************

; EQUATES SECTION

TMR0       EQU       1      ; means TMR0 is file 1
STATUS       EQU       3      ; means STATUS is file 3
PORTA       EQU       5      ; means PORTA is file 5
PORTB       EQU       6      ; means   PORTB is file 6
ZEROBIT       EQU       2      ; means ZEROBIT is bit 2
COUNT       EQU       0CH      ; means COUNT is file 0C
            ; a register to count events
            
;*****************************************************************************
            
    LIST        P=16F84   ; we are using 16F84
    ORG           0         ; the start address in memory is 0
    GOTO       START      ; goto start
            
;*****************************************************************************

;*****************************************************************************   
            
; SUBROUTINE SECTION
            
; 1 second delay
DELAY1       CLRF    TMR0       ; start TMR0
LOOPA       MOVF    TMR0,W       ; read TMR0 into W
       SUBLW   .32          ; TIME -32
       BTFSS   STATUS,ZEROBIT  ; check TIME-W = 0
       GOTO    LOOPA       ; time is not = 32
       RETLW   0          ; time is 32, return
      
; 0.5 second delay
DELAYP5       CLRF    TMR0       ; start TMR0
LOOPB       MOVF    TMR0, W       ; read TMR0 into W
       SUBLW   .16          ; TIME -16
       BTFSS   STATUS,ZEROBIT  ; check TIME-W = 0
       GOTO    LOOPB       ; time is not = 16
       RETLW   0          ; time is 16, return             
      
; CONFIGURATION SECTION

START       BSF       STATUS,5       ; Turns to BANK1
       MOVLW   B'00011111'
       TRIS    PORTA
       MOVLW   B'00000000'
       TRIS    PORTB       ; PORTB is OUTPUT
       MOVLW   B'00000111'       ; prescaler is /256
       OPTION          ; TIMER is 1/32 secs.
       BCF       STATUS,5       ; return to BANK0
       CLRF    PORTA       ; clears PORTA
       CLRF    PORTB       ; c;ears PORTB
      
;*****************************************************************************
      
; PROGRAM STARTS NOW
      
BEGIN       BSF       PORTB,0       ; turn ON B0
       CALL    DELAY1       ; wait 1 second
       BCF       PORTB,0       ; turn OFF B0
       CALL    DELAY1       ; wait 1 second
       GOTO    BEGIN       ; repeat
       END             ; you must end !!!


Please help !!! Thank you very much in advance.

            
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14481
  • Country: fr
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #1 on: February 19, 2019, 11:51:49 pm »
I haven't used the 16F family in ages, but I think you need to set the config bits somewhere. This will set, among other things, the oscillator source. I bet the clock is not running because the config bits are not properly set.
 
The following users thanked this post: Zybyyy

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1612
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #2 on: February 19, 2019, 11:53:04 pm »
Whilst it is admirable you're starting with assembly language (which is fine, but doesn't really give you any advantage over C, and makes life harder) and working from a book, the PIC16F84 is and ancient device.  Even the flash version, the PIC16F84A is what, 25 years old?  The PIC16F628A is newer, but not much.  This means they are both pretty basic, but perhaps more importantly, can be rather expensive, and difficult to program. 

With that said.. a PICkit 2 is fine for this, and the micro's lack of peripherals I suppose can be an advantage, as they really only have things like a couple of timers, comparators and a UART for the 628A. So when using assembly, - there's less things to turn off in the init routines.

Now, the code.  Please use code tags - highlight the code you posted and click the '#' button above the textbox.  Or enclose the code in [ code ] [ / code] (without spaces).

This is specifically for the PIC16F84.  The line "LIST P=16F84" tells the compiler what processor, and is usually with an "#include <p16F84A.inc>" which loads a file containing the register names and address.  Thats essentially what your "equates" section is doing, but including the above, will do that for you.  Search your MPLABX folder for "p16F84.inc" and "p16F84A.inc"  - these will show your all the register names used in mpasm assembly and their registers for that processor.  For the purposes of your code, the 84 and 84A are essentially the same, but may *not" work with the PIC16F628A without changes.

The main program - between BEGIN and END - looks fine, very simple.  The config code also looks OK - correctly setting PORTB as output, PORTA as input, configuring TMR0 prescaler etc..   So I'm thinking this is a hardware problem.  Your schematic shows a 32kHz crystal oscillator with 68pF caps.   In order to use that kind of crystal the "config" bits in MPLAB should be set for it.  See page 23 of the datasheet ( https://ww1.microchip.com/downloads/en/devicedoc/35007b.pdf )  it should be configured for LP Oscillator.  I believe the default is for an RC oscillator which requires a capacitor and resistor instead of a crystal.  If you have set the config bits, please post the "Config word" you see in PICKit2 when you load in your hex file and flash it. It'll be something other than 3FFF (which means its not configured).

If you have access to a function generator, or something that will generate a 5V square wave of anything from 1kHz to 100kHz, you could put this on OSC1 pin (pin 16) to clock the device.  If the LED blinks then, you know you've successfully programmed the device, and the code works.  If you wish to use your 32Khz watch crystal, then you'll need an oscilloscope to check it is oscillating.

edit: siliconwizard beat me to it :(
 
The following users thanked this post: Zybyyy

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4103
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #3 on: February 20, 2019, 12:53:40 am »
Most of the problem has already been covered.

Additional 2 cents:
In addition to ensuring the oscillator settings are correct in your configuration settings, you also have to make sure the WDT is off. Since there is no handling of WDT in this code, if you turn/leave WDT on, the chip will just continually reset itself and start the code over from the beginning.

<edited for brain fart.>
From the datasheet:
Quote
bit 4 CP: Code Protection bit
1 = Code protection disabled
0 = All program memory is code protected
bit 3 PWRTE: Power-up Timer Enable bit
1 = Power-up Timer is disabled
0 = Power-up Timer is enabled
bit 2 WDTE: Watchdog Timer Enable bit
1 = WDT enabled
0 = WDT disabled
bit 1-0 FOSC1:FOSC0: Oscillator Selection bits
11 = RC oscillator
10 = HS oscillator
01 = XT oscillator
00 = LP oscillator

An alternative to using MPLAB configuration menu, you can write this stuff in your header, manually. This way when you share your project, like in a book, this information is clear. It's weird he wrote out those defines/equs (which are sorta redundant), but he didn't write out the configuration stuff. There's only 4 things in the configuration word.

Manually, you could just write at the top of your .asm page. It looks something like this. TBH, I'm not sure what osc setting you need, if it's ext/int, or how to spell it exactly. And I don't know how I learned this or where to look it up. I suppose it should be documented in the IDE manual somewhere. Maybe they're defined in the .inc file? I must have copied it from somewhere... I have dicked around and figured out many configuration instructions since then by trial and error.

__CONFIG     _WDT_OFF & _PWRTE_ON & _ExtLP_OSC & _CP_OFF

Alternatively, you could figure out the bits and just write it like that, too.
__CONFIG  <insert the 5 bit configuration word, here, from 4,3,2,1,0, in dec/hex/binary, w/e you want>

example, I think you could write it like
__CONFIG  b'10000'

or

__CONFIG 0x10

*edit: since your .asm page doesn't include the 16f84.inc file (like BuriedCode has suggested), the first way I did that will probably not work! But the direct number should.
« Last Edit: February 20, 2019, 01:34:44 am by KL27x »
 
The following users thanked this post: Zybyyy

Offline notsob

  • Frequent Contributor
  • **
  • Posts: 696
  • Country: au
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #4 on: February 20, 2019, 01:31:50 am »
Although these are quite old, pcbheaven has some PIC assembly tutorials

pcbheaven.com
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4103
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #5 on: February 20, 2019, 01:58:28 am »
Found it. This stuff is defined in the .inc file

Quote
;----- CONFIG Options --------------------------------------------------
_FOSC_LP             EQU  H'3FFC'    ; LP oscillator
_LP_OSC              EQU  H'3FFC'    ; LP oscillator
_FOSC_XT             EQU  H'3FFD'    ; XT oscillator
_XT_OSC              EQU  H'3FFD'    ; XT oscillator
_FOSC_HS             EQU  H'3FFE'    ; HS oscillator
_HS_OSC              EQU  H'3FFE'    ; HS oscillator
_FOSC_EXTRC          EQU  H'3FFF'    ; RC oscillator
_RC_OSC              EQU  H'3FFF'    ; RC oscillator

_WDTE_OFF            EQU  H'3FFB'    ; WDT disabled
_WDT_OFF             EQU  H'3FFB'    ; WDT disabled
_WDTE_ON             EQU  H'3FFF'    ; WDT enabled
_WDT_ON              EQU  H'3FFF'    ; WDT enabled

_PWRTE_ON            EQU  H'3FF7'    ; Power-up Timer is enabled
_PWRTE_OFF           EQU  H'3FFF'    ; Power-up Timer is disabled

_CP_ON               EQU  H'000F'    ; All program memory is code protected
_CP_OFF              EQU  H'3FFF'    ; Code protection disabled

So if you "#include p16f84a.inc" in your code, you can select your configuration like this:
__CONFIG _PWRTE_ON & _CP_OFF & _WDT_OFF & <include the define for your oscillator, here!>

(there are 2x underscores in front of "CONFIG" and only one everywhere else.)

*Also, while perusing these files, I found my source of how I learned to use this __CONFIG directive... At least with the older versions of MPLAB, they include device specific template asm files to help get you started. They all have an example of how to use the __CONFIG directive.

Try going to your drive where you installed the IDE > Program files x86 (or whatnot) >Microchip >MPASM Suite

This folder contains the .inc files, and it has a folder named "templates" where you can get example asm templates for your device. After the first one you do, you will probably never use it again.
« Last Edit: February 20, 2019, 02:55:26 am by KL27x »
 
The following users thanked this post: Zybyyy

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3365
  • Country: nl
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #6 on: February 20, 2019, 03:02:32 am »
Do you have any particular reason for using assembly or a pic?

Assembly is nowadays only usefull in a few niche applications and for coarses of learning computer architecture, but has hardly any use for writing uC applications.
It can be done, but just because it can does not mean you should do so.
You can scratch with nails into a clay tablet, but you can also use a typewriter.

Euhm.
Finding a nail to write into some clay is probably a lot easier than finding an actual typewriter nowaday's. but the're both obsolete.

The PIC microntollers are also not the best uC architecture for writing software, but when you use a "higher language" most of the annoying stuff is abstracted away. "arduino" is C / C++ and fairly easy to get started with, but that platform has unfortunately crippled itself into a stat to only being useable for simple beginner projects.

For a beginner that wants more than "only blinking leds" probably anything that has a good quality C compiler available is a good option.
Some of the C / C++ compilers for uC's are still very expensive, or are crippled into only being able to make small programs. There is however the omni present GCC which is Free & Open Source and has been ported to several different uC architectures.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4103
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #7 on: February 20, 2019, 03:28:49 am »
Quote
Finding a nail to write into some clay is probably a lot easier than finding an actual typewriter nowaday's. but the're both obsolete.
The typewriter is obsolete. It was made by some dudes who had some ideas about how best to print stuff. Then it was superceded by something better.

Clay and nails will be useful forever.
 
The following users thanked this post: TomS_

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #8 on: February 20, 2019, 09:36:51 am »
Hi,

As you say you have those chips , then you might find this assembly tutorial more practical than your book, its one I got many years ago and equally found  not to be that helpful.

The WinPicProg author is still active so plenty of help around.

http://www.winpicprog.co.uk/pic_tutorial.htm

Though you are using MPlabX , the older but simpler IDE, MPlab V8.92  is still available from Microchip as a download.


Edit,  also using a crystal on a breadboard can often result in problems due to its fine leads etc.

Much better to use the 628A chip which has its own inbuilt 4mhz oscillator.
Think I still have one of those chips so can run a led flasher code up on it if you are stuck.

« Last Edit: February 20, 2019, 10:26:58 am by picandmix »
 
The following users thanked this post: Zybyyy

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #9 on: February 20, 2019, 10:59:59 am »
It looks OK (but it's been a long time), and it simulates approximately way you'd expect, but even in simulation, the PORTB bit isn't changing :-(

Actually, the TRIS registers aren't changing either...   That really implies that something is wrong with your bank selection... Hmm...
Ah hah!
Code: [Select]
START       BSF       STATUS,5       ; Turns to BANK1
       MOVLW   B'00011111'
       TRIS    PORTA
       MOVLW   B'00000000'
       TRIS    PORTB       ; PORTB is OUTPUT
       MOVLW   B'00000111'       ; prescaler is /256
       OPTION          ; TIMER is 1/32 secs.
       BCF       STATUS,5       ; return to BANK0
The TRIS and OPTION "instructions" don't need you to switch banks; they directly modify the TRIS and OPTION registers regardless of the current bank.  If I remove the BSF/BCF of the status register, the simulation will blink!So I guess ... TRIS and OPTION instructions don't work with the banks.
Note that the datasheet (for 628) says:   
Quote
2: To maintain upward compatibility with future PICmicro products, do not use the OPTION and TRIS instructions.
So correct code would look like:
Code: [Select]
START       BSF       STATUS,5       ; Turns to BANK1
       MOVLW   B'00011111'
       MOVWF TRISA
       MOVLW   B'00000000'
       MOVWF TRISB       ; PORTB is OUTPUT
       MOVLW   B'00000111'       ; prescaler is /256
       MOVWF OPTION          ; TIMER is 1/32 secs.
       BCF       STATUS,5       ; return to BANK0
   
 
The following users thanked this post: Zybyyy

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #10 on: February 20, 2019, 03:21:47 pm »
Hi,

Only had a 628 chip in the box, not the 628A so could only simulate the code, though it works ok.

 
The following users thanked this post: Zybyyy

Offline ZybyyyTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #11 on: February 20, 2019, 09:31:07 pm »
Thank you all for your comments and help.
I will try this solutions and see where I am.

I am really interested in the microcontroller - robotics world and would like to learn what is the best.
Can you please advise on best language nowadays to learn?
I  understand PIC is a bit "dated" but someone told me that this is a must foundation for programming?

Thank you very much again!
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4103
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #12 on: February 20, 2019, 10:44:16 pm »
That's easy. Assembly programmers are dickhead dinosaurs. You should be using Ar-Dwee-No! No, wait, Raspberry Pi. I want Raspberry Pi running linux controlling the ABS brakes in all the cars around me.

Learn w/e interests you. Don't be a dickhead assembly programmer. Don't be a dickhead higher level program user that thinks he can make autonomous drones fly at 100 mph and avoid objects by connecting to a computer through the internet. There's computing power and memory and there's latency. You can't overcome latency with more memory and computing power.

We got different tools for different jobs. Ideally, you will be able to use the best tool for the job. Practically, you will often force a square peg into a round hole and it will work just fine, so long as you know what you're doing.

Even if you have a CNC machine, it it helpful to know how to use a chisel. I wouldn't spend 10 years to try to become Michael Angelo or Paul Sellers. But some basic knowhow can be useful. Sometimes a compiler doesn't do exactly what you want it to. Sometimes your C code will work fine with one compiler but it is bugged with another. Some things are more easily done or fixed in asm. Esp if you are interested in robotics and hardware. The main brain and computer interface for your robot might run linux, but there may be hundreds of sensors and motors with their own controllers and subsystems that need to react very quickly to very simple algorithms.
« Last Edit: February 20, 2019, 11:14:41 pm by KL27x »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #13 on: February 20, 2019, 11:04:28 pm »
Quote
I understand PIC is a bit "dated" but someone told me that this is a must foundation for programming?
As a foundation for embedded programming, you should indeed learn some "fundamental" about registers, memory, timers, asynchronicity and busy loops, and the pain of what goes on in the actual chip.
an old PIC is probably as good as anything for that - newer chips have significantly more complexity that masks some of those basics.   I'm a little bit in awe of how little code it took to configure that PIC timer - a modern ARM chip is likely to have at least 4 types of timer to chose from, some with up to 128bytes of configuration.
The problem with a really ancient chip like the PIC16F628 or (even older) 16F84 is that most of what you learn there will be ONLY "foundational."  It won't give you the knowledge needed to build a modern project or product, and it won't be a key phrase on your resume.  You need to learn some of those fundamentals and quickly move on to seeing how they apply in a more modern environment.
 
The following users thanked this post: Zybyyy

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5029
  • Country: ro
  • .
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #14 on: February 20, 2019, 11:21:35 pm »
Nothing wrong with PIC microcontrollers, it's just your approach.

C compilers are now good enough to generate decent code, so you don't need to program in assembly anymore.
The programming IDE (MPLAB and MPLAB-X) is free, and you have lots of tutorials online that can teach you how to program with C.

The Pickit 3 programmer bundled with a circuit board and a microcontroller even had a CD with guides and tutorials that explained how to use MPLAB IDE (the one before MPLAB-X) and had example programs.

Actually, let me see if I can find that CD...  and here's an ISO image of the CD that came with the programmer:  http://savedonthe.net/a/microchip/IDE_8_60.ISO (I'll leave it there for a few days)

Here's just the pdf that contains some simple C examples ( lessons that worked on the micro with the dev board but most work with any pic16f or pic18f micro) : http://savedonthe.net/download/2362/PICkit_3_Lessons_UG_41370c.html

You can replace MPLAB with MPLAB-X  and the download should come with documentation and c compilers in the package and everything you need: https://www.microchip.com/mplab/mplab-x-ide


You can easily adapt the lessons to other microcontrollers, you don't have to buy the exact chip they use in the lessons.

 
The following users thanked this post: diyaudio, Zybyyy

Offline ZybyyyTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #15 on: February 21, 2019, 01:03:07 pm »
Thank you very much for that.

Now I am thinking going between C and Python. Probably will go with Python.
Thank you again. Great forum, great job everyone !
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3146
  • Country: ca
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #16 on: February 21, 2019, 02:28:04 pm »
Probably will go with Python.

Using Python to learn programming is like becoming electrician to learn Ohm's law.
 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #17 on: February 21, 2019, 02:39:55 pm »

Quote
I understand PIC is a bit "dated" but someone told me that this is a must foundation for programming?

As a foundation for embedded programming, you should indeed learn some "fundamental" about registers, memory, timers, asynchronicity and busy loops, and the pain of what goes on in the actual chip.


Agree with @Westfw and the advice you say had initially  received.

You already have the Pic equipment and access to good tutorials so why not spend some time learning about them from the ground up; it is a good foundation that the higher level languages do not always give you, relying mostly  on existing libraries written by others, so you learn very little by comparison.

Nothing to stop you  later moving onto C, C++, Python  etc.

Look in the local and national job  adverts and see what languages  the  market is seeking  or  check your local colleges and its computing courses which should be geared to local needs.
 
The following users thanked this post: Zybyyy

Offline jackthomson41

  • Regular Contributor
  • *
  • Posts: 53
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #18 on: February 22, 2019, 03:25:21 pm »
why people are still working on assembly language for PIC16F877a, I'll never know.  |O
« Last Edit: November 11, 2019, 12:36:12 am by jackthomson41 »
 

Offline NivagSwerdna

  • Super Contributor
  • ***
  • Posts: 2495
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #19 on: February 22, 2019, 05:13:22 pm »
Try using RB1 and report back.  (RB0 is also INT)
 

Offline member_xyz

  • Contributor
  • Posts: 47
  • Country: au
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #20 on: February 22, 2019, 10:35:44 pm »
Quote
Probably will go with Python

 :wtf: Now you going from ASM to Python????
It's pointless commenting or offering you any advice.

You need to learn the hard way.


 

Offline ZybyyyTopic starter

  • Newbie
  • Posts: 4
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #21 on: February 23, 2019, 11:49:49 pm »
Quote
Probably will go with Python

 :wtf: Now you going from ASM to Python????
It's pointless commenting or offering you any advice.

You need to learn the hard way.

member_xyz - Thank you very much for your "advice", as I looked up you did not contribute to the positive discussion so please spare yourself those comments.

And on the other note I found the problem  ;D
I jumped the guns a bit. I missed a part in the book where it says how to setup Arizona programmer - I thought not for me I have PICkit 2, well... I did wrong.
There is a part where it talks about FUSES setup and LP oscillator setup. I set it as per book and it was beautifull. !!! Guys you were right !!!

Massive thank you very much to all helpfull members.
Special thanks to: westfw, mariush, picandmix
Yes !!! I will continue now with ASSEMBLY as I have the book and this error on my side just tought me a lot about PIC setup differences and how do they work.
I will continue to have a good, old days understanding.


why people are still working on assembly language, I'll never know.  |O

Jack - I am learning using ASSEMBLY to know how to operate chisel before CNC  ;)


What I discovered:
- The program is fine and all good but only for PIC16f84. Instead of using PICkit 2 I used K150 programmer and it was all clear - I need to setup FUSES correctly
- PIC16f628A does not like that program beacuse of the instructions like it was said in comments.

I have read most of the book and the tasks are much clearer now.

Thank you very much again for your time!
Best regards !


 

Offline picandmix

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #22 on: February 24, 2019, 12:05:28 am »
Glad you have found your way,  enjoy  ;D

Microchip have their own MPASM forum, though quiet a few of their experienced and helpful members are also here in EEVblog  so can  help if needed.
 
The following users thanked this post: Zybyyy

Offline @rt

  • Super Contributor
  • ***
  • Posts: 1059
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #23 on: March 01, 2019, 03:46:32 am »
I find it very assuming to dissuade someone from learning assembly without even questioning their motivation for it.

Some might say you can have no understanding of how a computer works until you’ve written at least some kind of cyclic program.

I’d agree, and go further to say you can’t have as intimate knowledge of what’s actually going on inside a controller until you’ve
copied a value from a register to an accumulator, performed an operation on it, and copied back to a register...
or used a program counter to jump to an address, or a bunch of other things that are abstracted away by higher level languages.

Or you might simply enjoy the idea of achieving a result with the least resource, etc.

I think assembly is the best start, because most people will never go back if they begin with a higher level language.
 

Offline KL27x

  • Super Contributor
  • ***
  • Posts: 4103
  • Country: us
Re: Help with PIC / ASSEMBLY for a project from a book
« Reply #24 on: March 02, 2019, 08:55:16 am »
Different strokes, yeah.

I've heard the old "C compilers are very reliable, these days. There's no need for assembly."

The devices and compilers and IDE tools we use today are going to be obsolete, tomorrow. That might not matter to you. You'll just switch to the new one. But some people are making the new compilers. Some humans are adding support for new devices. Some people are writing and modifying C libraries. Some people are writing inline assembly.

Cars are very reliable, today. This doesn't mean every person on the planet needs only to know how to pump the gas and turn the ignition key. There are people who work under the hood. There are people designing new cars. Every part of the car, there are people redesigning and improving each aspect. That might not be for you; maybe you just want to drive. And maybe you don't care if progress stopped, today. And you could drive the car you're comfortable with, forever. I know that would be fine to me. But we have an economic model that only works on constant change improvement, and so the gears will keep turning. And there will be people maintaining and changing and sometimes even improving the tools that you use.
« Last Edit: March 02, 2019, 09:24:18 am by KL27x »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf