Model Boat Mayhem

Please login or register.

Login with username, password and session length.
Pages: 1 2 3 4 5 [6] 7   Go Down

Author Topic: Help writing pic code  (Read 32013 times)

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #125 on: October 03, 2014, 07:18:23 pm »

Hi Stew,

There may be a roll-over from zero to 255 in the LOOPP. It may be worth examining the logic in detail of 2's compliment decrementing, i.e.  ADDLW    d'255'        ;dec W

The other method of decrementing is to use the DECFSZ instruction - decrement f, skip if zero.

Ian
Logged

TurboTyne

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 115
  • Location: Newcastle upon Tyne, England
Re: Help writing pic code
« Reply #126 on: October 03, 2014, 08:00:59 pm »

Ah yes, of course - I'd not focussed properly on the end stages.
O.K., I think you need to test the ADC result for zero before you do the first addition of 255. If zero then exit before entering the loop OR if zero then increment it to value 1.
At prersent, if the W register is zero, you then add 255 to give a result that is 255. This then gives the max delay before your timing is complete.
The 2's complement maths works since the value 255 is -1 in 2's complement. But, the PIC does not realise this and just thinks it is the value 255.

Regards  Mike
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #127 on: October 04, 2014, 06:48:52 am »

Hi Stew,

This is similar to the old "divide by zero" problem - you have to check the extreme cases which screw up the logic.

One little tip for ease of code reading is to assign (EQU statement) to the register bit numbers,  e.g. STATUS,2 becomes STATUS,ZERO. It saves referring back to the data sheet, viz:-

;----- STATUS Bits --------------------------------------------------------
IRP                     EQU     H'7'
RP1                     EQU     H'6'
RP0                     EQU     H'5'
NOT_TO              EQU     H'4'
NOT_PD                  EQU     H'3'
ZERO                     EQU     H'2'
DC                      EQU     H'1'
CARRY                  EQU     H'0'

or what ever description helps.

No, I haven't got insomnia - we've just collected our daughter from Gatwick Airport!

Ian
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #128 on: October 04, 2014, 07:02:27 am »

Hi Stew,

A method of testing for ZERO is to move a register into itself since it affects the STATUS zero flag - see instruction MOVF.

E.G.

                MOVF    DELAY,1                           ; Move DELAY into itself then test for zero.
                BTFSS   STATUS,ZERO                       ; Test STATUS for zero.

Ian
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #129 on: October 05, 2014, 09:30:19 am »

Hi
The problem was indeed caused by the analogue input being zero, now sorted.
Ian, you mentioned the analogue converter using a cap, does each analogue channel have their own cap or is one shared by all of them? The reason I am asking is that I now have to add another analogue input and the acquisition time might become a factor.
Cheers
Stew
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #130 on: October 05, 2014, 01:32:53 pm »

Hi Stew,

Glad you sorted the "zero" problem - bet you're getting into the swing of re-programing the PIC.

The hold capacitor seems to be shared by all inputs, since its after the select switch SS (Fig 9.4).

Looking at my code, I select the channel, set the A/D convertor on, wait 50us for acquisition, start the A/D conversion and then go off and process the rest of the code (in my large program it may take 0.1s).

Coming back through the start of the analogue code section, I check to see if the analogue conversion is complete, if so, then I transfer the ADRESH/L into my variable (Temp, Pressure etc.) and then finally change the channel select bits (CHS) for the next analogue channel and then repeat the cycle.

So, for four analogue inputs to update in my code, it takes 0.4s which is more than adequate for the slow moving inputs.

I use the 16F877 PIC and I've noticed the input source resistance maximum value is only 2.5kohm much lower than the 10k of the 684 and I've never had any problems with 10k pots as the inputs.

Ian


Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #131 on: October 07, 2014, 07:08:54 pm »

Hi
Well we're half way there, the boiler pressure side of things is now all sorted.
Next is the turn of the water level. This should be fairly straight forward except that I will have to store a calibration value in eeprom. I've read the datasheet several times but it's just not clicking, anyone got any tips on how to store and read data in eeprom?
cheers
Stew
Logged

TurboTyne

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 115
  • Location: Newcastle upon Tyne, England
Re: Help writing pic code
« Reply #132 on: October 07, 2014, 10:55:00 pm »

 Hi Stew


I have code that stores a set of about 20 values in dataEEPROM. It is ages since I looked at this but below is an edited version of my write and read subroutines. I read and write the data from/to a series of registers so I have simply indicated a silly name for single registers in this example.  The process is tricky because you have to go through a sequence of events and then wait for the write process to complete.  First thing is to tell the device which EEPROM location you want to write to / read from. In my case this is the value stored in 'byte_count'.


This is on a PIC16F8127. I looked very quickly and the control registers for dataEEPROM in your PIC seem the same.
Maybe best to have a look at this stuff and come back with further questions.

Good luck.
Mike



write_byte
                BANKSEL                    byte_count

                 movf                          byte_count, W                 BANKSEL                   EEADRL
                movwf                       EEADRL                               ; place current value of byte_count into EE address reg.
                movf                          value_to_be_stored, W
                BANKSEL                    EEDATL
                movwf                        EEDATL                                ; copy data at current register to EEDATL
 
                bcf                                          EECON1, CFGS                                      ; select programme & data space
                bcf                                          EECON1, EEPGD                                    ; select data
                bsf                                          EECON1, WREN                                    ; enable writes
 
                bcf                                          INTCON, GIE                                         ; disable interrupts
                movlw                                  55h
                movwf                                  EECON2
                movlw                                  0AAh
                movwf                                  EECON2
                bsf                                       EECON1, WR                                                               ; start write operation
                bsf                                       INTCON, GIE                                                                 ; enable interrupts
                bcf                                        EECON1, WREN                                                           ; disable writes
                BTFSC                                    EECON1, WR                                      ; wait for any current write operation to complete.
                goto                                       $-2
 
                  return 
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 read_byte
                BANKSEL              byte_count
                movf                     byte_count, W
                BANKSEL              EEADRL
                movwf                  EEADRL                                                 ; place current value of byte_count into EE address reg.
 
                bcf                          EECON1, CFGS                                   ; select programme & data space
                bcf                          EECON1, EEPGD                                 ; select data
                bsf                          EECON1, RD                                        ; start EEread
                movf                       EEDATL, W
               BANKSEL                 register_to_be_written

                movwf                    register_to_be_written                      ; move latest data byte into relevant register.
                 return
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #133 on: October 08, 2014, 09:13:22 am »

Hi Mike,

I had a lot of trouble getting the EEPROM write routine to work reliably with multiple writes.

I used the 16F877 PIC and followed the data sheet example where the WR flag is tested at the beginning of the routine to check that any previous writes were completed before any additional writes were attempted. I couldn't get that to reliably work, so, I tried using EEPROM's write complete interrupt with no success.

Finally, I placed a 4ms delay at the end of each write and it worked reliably. The delay didn't impinge on the normal code running since it was only used for manual settings (of two bytes each) which were changed as necessary.

I should have perhaps attempted putting the "WR" bit test at the end of the WRITE routine as in your code.

Ian
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #134 on: October 08, 2014, 10:35:29 am »

Thanks Mike
I'll study your routines and try to "pic" the bones out.
Cheers
Stew
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #135 on: October 29, 2014, 05:04:50 pm »

Hi all
well I'm close but still no cigar.
I'm having a problem adding a calibration routine. I want the program to go to a calibration subroutine if the unit is powered on while a push button is pressed.
For some reason it is not recognizing that porta,2 is set even though I have weak pullups enabled.
If I add an external resistor all is well but I would like to use the internal pull up resistor.
I have a push button connect between ground and porta,2.
If I test the pin with a meter the weak pullups appear to be working, is there perhaps a delay before the pullups are enabled?

Here is the code that I am using, there is probably a glaring mistake but I'll be damned if I can find it.
Help please
Stew

; EQUATES SECTION

TMR0              EQU        H'01'    ;means TMR0 is file 1.   
STATUS           EQU        H'03'    ;means STATUS is file 3.   
PORTA            EQU        H'05'    ;means PORTA  is file 5.   
PORTC           EQU        H'07'    ;means PORTB is file 7.
INTCON          EQU        H'0B'    ;INTCON is file 0BH
TRISA             EQU        H'85'    ;TRISA (the PORTA I/O selection) is file 85H
TRISC             EQU        H'87'    ;TRISC (the PORTC I/O selection) is file 87H
OPTION_REG     EQU        H'81'    ;the OPTION register is file 81H   
ZEROBIT         EQU        H'02'    ;means ZEROBIT is bit 2.   
WPUA             EQU        H'95'    ;weak pull-ups is file 95H
ANSEL            EQU        H'91'    ;analogue select register
CMCON0        EQU        H'19'    ;comparator configuration register
ADCON0         EQU        H'1F'    ;adcon0 register
ADCON1         EQU        H'9F'    ;adcon1 register
ADRESH          EQU        H'1E'    ;adresh register
ADRESL          EQU        H'9E'    ;adresl register
COUNTERA     EQU        H'20'    ;countera register
COUNTERB     EQU        H'21'    ;counterb register
COUNTERC     EQU        H'22'    ;counterc register


;*********************************************************

    LIST    P=16F684    ; we are using the 16F684.
    ORG        0            ; the start address in memory is 0
    GOTO    START        ; goto start!

;**********************************************************************
; Configuration Bits
    __CONFIG    H'3084'

;*********************************************************

START   
    BANKSEL    TRISA   
    MOVLW   B'00101101'    ;porta bits 0, 2, 3 & 5 are i/p
    MOVWF   TRISA
    MOVLW    B'00001010'    ;portc bits 1 & 3 are i/p
    MOVWF    TRISC       
    BSF          OPTION_REG,7
    MOVLW    B'00110111'    ;weak pull-ups enabled
    MOVWF    WPUA        ;on PORTA pins 0,1,2,4,5
    CLRF        ANSEL        ;ports set to digital i/o
    BANKSEL    PORTA
    MOVLW    H'07'
    MOVWF    CMCON0        ;comparators off digital i/o
    CLRF        PORTA        ;CLEARS PORTA
    CLRF        PORTC        ;clears PORTC.
    BTFSS      PORTA,2        ;test for calibrate switch press
    CALL       CALIBRATE
Logged

TurboTyne

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 115
  • Location: Newcastle upon Tyne, England
Re: Help writing pic code
« Reply #136 on: October 29, 2014, 06:35:47 pm »

Hi Stew

I was wondering how you've been getting on.

I've never used the pull-ups so was interested by your query since it prompted me to learn a little about this feature of the PICS.
So please bear in mind that I have not dabbled with these settings myself, however, I noticed the following in the data sheet regarding the OPTION register:

bit 7 RAPU: PORTA Pull-up Enable bit
1 = PORTA pull-ups are disabled
0 = PORTA pull-ups are enabled by individual PORT latch values

I see that your code sets OPTION bit 7 and it seems that this should disable the pull-ups. Do you set this bit for a reason that I'm not aware of or could this be the cause of the problem?

But, you say the pin appears to be high when tested with a meter. I just wonder how meaningful was your test. e.g. did you connect the pin to ground via a high value resistor while making the measurement? If not, I wonder if the voltage on the pin would have drifted high even if pull-ups were disabled, since the inputs will be high impedance and presumably so was your test meter.
Hopefully Ian will have some more expert comments on this.

Regards,  Mike
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #137 on: October 29, 2014, 07:04:26 pm »

Thanks Mike
Option_reg bit 7 should indeed have been 0. Probably the only place where 0 means on and 1 means off.
I must learn to read the datasheet more thoroughly.
Thanks again
Stew
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #138 on: November 03, 2014, 02:42:26 pm »

Well I finally got to smoke that cigar.

I would like to thank everyone who helped me with this project, I certainly couldn't have done it without you.

There is 1 slight niggle though. When the power is switched on the servos give a little twitch to the right, not much but enough to extinguish the pilot light.
I don't think this is a problem with the code as it also happens with the pic removed from the circuit. I have googled this problem and there are lots of questions about it but no answers as far as I can see.
Has anyone experienced this and come up with a solution? It appears to happen if power is supplied to the servo before it receives a signal.

How about that pint Mike?

Regards
Stew
Logged

Mad Scientist

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 264
  • Model Boat Mayhem is Great!
  • Location: Dartmouth, Nova Scotia, Canada
Re: Help writing pic code
« Reply #139 on: November 03, 2014, 10:06:06 pm »

Congratulations on completing the project!  :-)) It's been fascinating to watch it all come together.

Tom
Logged

TurboTyne

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 115
  • Location: Newcastle upon Tyne, England
Re: Help writing pic code
« Reply #140 on: November 04, 2014, 10:43:03 am »

Hi Stew

Well done! 

Is your control system in a model boat at present?
Do you have plans for further PIC projects now you've learnt a lot about using the devices?

RE: that pint, it would certainly be good to meet up and I'd be very interested to see your boiler etc.

Maybe we can get in touch again via PM?

Regards

Mike
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #141 on: November 04, 2014, 04:05:38 pm »

Congratulations Stew on climbing that steep learning curve - well done mate!

Re the pilot gas valve servo, I suppose you relight the pilot after the servo has settled down. To be clever, you could get the PIC to operate a relay that applies power to the servo after a PWM signal is present.

I had a similar problem with the ESCs powering the water pump motors. On switch on the ESCs wanted to see a 1ms PWM for a few seconds before the pump speed PWM (>1ms) was applied otherwise the ESCs wouldn't start. The PIC was programmed to apply the 1ms signal as required.

Also, I wanted the main gas control valve to be properly shut at start up so the PIC was programmed to open slightly and then apply a shut value. Doing it this way over came any stiction. Your code can now be modified with ease to over come these slight niggles.

Your project was a useful revision course for us all!

Ian
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #142 on: November 04, 2014, 07:24:57 pm »

Hi Mike
The system is not actually in a boat at the moment.
I was given a boat with a Cheddar Proteus plant fitted with a Cheddar ABC system. I thought it would be a nice project to try and build a similar system, and so the story began.
I started building the first box with very little electronics knowledge, learning curve no.1. I then wanted to take it to the next level and build using a pic or similar and that's when this episode started. It's amazing how much knowledge I've gained simply because someone gave me a model boat.

I would again like to thank everyone who has helped and encouraged me through this project, I couldn't have done it without you.

I think my next project is going to be a Sun following solar panel and charging system for when I'm away camping.

I'll pm you Mike when I've got this mounted in an enclosure and let you see what I've built.

Thanks
Stew
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #143 on: December 03, 2014, 05:30:20 pm »

Hi Everybody I'm back.
I'm trying to make something that will allow me to operate 2 systems from a single radio channel.
To do this I need to measure the length of the pulse from the radio receiver.

The PIC will be running at 4mhz and tmr0 will have a prescaler of 4.

The pulse will be between 1-2ms.

My plan is to wait until the pulse starts, start tmr0, wait until tmr0 = 250 (1ms), clear tmr0, wait until pulse finishes and read tmr0.

The code I have written so far for the 1ms delay is this

BEGIN
    BANKSEL    PORTA
    BTFSS    PORTA,3
    GOTO    BEGIN
    CLRF    TMR0
DELAY1MS
    MOVLW    D'250'
    SUBWF    TMR0,0
    BTFSS    STATUS,0
    GOTO    DELAY1MS
    CLRF    TMR0

The problem is the number of instruction cycles used. Is there a way to do this using fewer cycles?

Cheers
Stew
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #144 on: December 03, 2014, 06:22:03 pm »

Hi Stew,
This is a good example where the interrupts are useful.

Within the Interrupt Routine at the very start of the code, the external interrupt (i.e. the radio PWM signal) is detected and it is determined whether it is the rising or falling edge.

If it is the rising edge then start a timer, then depart from the interrupt routine and carry on with the other tasks.

If the external interrupt is caused by a falling edge, then stop the timer and read the value of the timer into your variable.

   BTFSS   INTCON, INTF   ; Test for external interrupt.
   GOTO   EXIT      ; Go to Interrupt Routine Exit
   BCF    INTCON, INTF   ; Clear the External interrupt interrupt flag.

   BTFSS   OPTION_REG, INTEDG   ; Is it a rising edge external interrupt,
               ; if so skip the next instruction.
   GOTO   FALLING_EDGE      ; It must be a falling edge interrupt.
   GOTO    RISING_EDGE      ; It must be a rising edge.

The timer value may have to be scaled according to its use in the other code. I found it best to scale it within the interrupt routine and export as a different variable; this avoids the required value being mysteriously changed in the non-interrupt part of the code i.e. the interrupt could change the value just as you are doing the scaling (bitter experience!).

Using the interrupt saves cycling around the same bit of code and holding up other tasks.

One additional feature is to detect loss of radio signal. In the same interrupt above you could set another timer (another interrupt!) which times out at 25ms if the rising signal doesn’t reset it after the standard 20ms gap. The loss of signal could be used to shut the gas valve.

Ian.
excuse the "tabbing", it never works properly.
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #145 on: December 03, 2014, 06:51:50 pm »

Hi Ian
As the pulse is between 1-2ms I was wanting to wait 1ms before timing the pulse in order to keep the resolution as high as possible.
This 1ms would then be factored in at the end.
Is it possible to use interrupts to start and stop the timing after the first 1ms?
Stew
Logged

flashtwo

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 521
  • Location: Sevenoaks, Kent, England
Re: Help writing pic code
« Reply #146 on: December 03, 2014, 10:51:47 pm »

Hi Stew,

I've been using Timer 1 which has a 16 bit resolution and counts in 1us increments, giving 0.1% resolution.

In my application I wanted a value of 0 to 1000 to represent Feed Flow demand of 0 to 200cc/min, therefor I subtracted 1000 from the Timer 1 value of 1000 to 2000us. I also use the Feed flow demand signal to enable the Gas Valve to open; above a certain value  (about three clicks on the transmitter joy-stick) the valve is allowed to start to open - below that value the Gas Valve has a hard shut signal.

The value of 0 to 1000 originally was the desired engine speed, but when that scheme failed to work, I used the value for feed flow - I suppose I could have used Timer 0, but that got used for loss of radio signal timeout.

You can certainly enable and disable the particular interrupts, e.g.  using INTE for the external interrupt, then using Timer 0 you would have 0.4% resolution which would be more than enough.

Ian
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #147 on: December 04, 2014, 09:20:34 am »

Hi Ian
Perhaps I should explain what I'm trying to do.

I want to control the throttle and the forward/reverse servos from the same stick.

When the stick is in the central position the throttle will be closed and the f/r servo is in the forward position. As the stick is pushed forward the throttle is progressively opened. When the stick is pulled back from centre the f/r servo moves to reverse and the throttle is again opened.

As you can see, half the travel on the stick equates to full travel on the throttle servo, halving the resolution.
If I used tmr0 to measure the full 2ms I would have to use a prescaler of 8, again halving the resolution.

Using tmr1 would be ideal but I'm not confident enough to do the maths on a 16 bit number.

I think I'll use the 1ms routine that I used in the previous project to measure the first 1ms and then either use a modified version of it or tmr0 to measure the remainder.

I don't think there is any point in using interrupts, other than as a learning exercise, as the program has nothing else to do until the pulse length has been acquired.

Perhaps if you have the time you could do a couple of short tutorials on interrupts and using 16bit numbers. I'm sure there are a few people on here who would benefit.

Cheers
Stew
Logged

TurboTyne

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 115
  • Location: Newcastle upon Tyne, England
Re: Help writing pic code
« Reply #148 on: December 04, 2014, 11:45:42 am »

 Hi Stew
 I’ll have a stab at 16-bit numbers which are really nothing to be scared of, especially if you are just working out a value to place in a timer register. Sorry if this is all too basic.

There are several ways of thinking about a 16-bit number, but maybe the simplest is to think of it as a two-byte number and forget about the 16 individual bits, at least for the time being. These 2 bytes are designated the upper and lower byte or the Most Significant Byte (MSB) and Least Significant Byte (LSB). In the details of16-bit timer registers you can see these designations.

So from the bottom up, as you know, a one-byte number can store decimal values from zero up to 255. If you have the value 255 in the lower byte and you increment it, the value of the byte returns to zero and the carry bit in the status register becomes set.  This is analogous to, in the decimal system, counting from zero up to 9 and then incrementing by one. In that case the units integer returns to zero and a one is carried over to the tens integer to make “10”.  With two-byte numbers, the carry is used to increment the upper byte of the 2-byte value. So every unit in the upper byte represents 256 in the overall two-byte value.

Therefore, to work out the value of a two-byte number you multiply the value stored in the upper byte by 256 and add the result to the value in the lower byte. Conversely, to work out the values to be placed in the 2 registers that store the two-byte number, simply divide the value of the number by 256. The whole number after rounding down is the value to place in the upper byte. Then work out the remainder and store that in the lower byte. E.g. to store 2000:  2000 divided by 256 = 7.8125  So place the decimal value 7 in the upper. Then 2000 – (7 X 256) =208. So place the decimal value 208 in the lower byte. You can check the answer by working backwards. i.e. upper byte X 256 + lower byte 208 should give 2000.

Things get a bit more complicated when you start doing maths with 16-bit values. Addition is easy. You add the two lower bytes and if carry is set you increment one of the upper bytes to be added together. Then you add the 2 upper bytes together. You need to be sure that the result is less than 65,535 since in that case you would need to employ 24-bit values.  If and when you need it, can post  subroutines that carry out 16-bit and/or 24/ 32-bit multiplication and division and also code for adding or subtracting multiple byte values.


Regards  Mike

 
Logged

megatron

  • Full Mayhemer
  • *****
  • Offline Offline
  • Posts: 70
  • Location: North Shields
Re: Help writing pic code
« Reply #149 on: December 04, 2014, 12:28:13 pm »

Hi Mike
I understand the principle of 16bit numbers being in 2 bytes and I could probably handle addition ok, but I also have subtraction, multiplication and division to do.
I would be very interested to see the routines you use.
Have you tried using any of the 16bit or 32bit pics?
regards
Stew
Logged
Pages: 1 2 3 4 5 [6] 7   Go Up
 

Page created in 0.122 seconds with 22 queries.