Search found 1469 matches

by Jerry Messina
Sun May 21, 2023 2:46 pm
Forum: Compiler
Topic: ISR Context Analyzer
Replies: 1
Views: 1749

ISR Context Analyzer

I put together a tool to analyze the ISR's in a program and make suggestions as to the required context save requirements. It looks at the .asm file output for any sub, register, event, and system library usage of interest and reports on what it finds. screenshot1.jpg To use it, first comment out an...
by Jerry Messina
Sat May 13, 2023 12:32 pm
Forum: Compiler
Topic: ISR context - saving TABLAT register
Replies: 0
Views: 10222

ISR context - saving TABLAT register

This isn't really a compiler issue, but this seems like the best place to put this... In the wiki article Interrupt Context Saving in an ISR I discuss the need to save the TBLPTR registers if your ISR accesses const data arrays or strings in program memory. Reading memory using the table pointer reg...
by Jerry Messina
Sat May 06, 2023 12:05 pm
Forum: General
Topic: PIC18F47Q84 USART over 3
Replies: 2
Views: 1467

Re: PIC18F47Q84 USART over 3

Is there a reason before i go reinventing the wheel (if indeed i can work out how to do that) on why you limited SF to 3 on this device? Simply a mistake on my part... looks like I didn't catch the full featured/limited featured part of things on the Q83 and Q84 parts. Just fyi - the Q43 has suppor...
by Jerry Messina
Mon May 01, 2023 1:03 pm
Forum: Compiler
Topic: ICC issue with const and division
Replies: 0
Views: 10212

ICC issue with const and division

There's a code generation issue involving const values and division, and crops up if you have something like: w1 = const / w2 where w1 and w2 are words and the const value is > 65535. Currently the compiler truncates the const value to a word and does a div16x16 operation, so the result will not be ...
by Jerry Messina
Fri Apr 28, 2023 2:52 pm
Forum: Modules
Topic: HPWM/HPWM2/HPWM3 hardware PWM modules
Replies: 16
Views: 80861

Re: HPWM/HPWM2/HPWM3 hardware PWM modules

The user module PWM2 on the wiki has provisions for using a table of PWM settings. The HPWM modules have a SetPWM() routine that can be used to provide a similar function. SetPWM() is a low-level routine that can be used in place of SetFreq(). It results in a program about 1/3 the size and more than...
by Jerry Messina
Wed Apr 26, 2023 1:44 pm
Forum: Modules
Topic: HPWM/HPWM2/HPWM3 hardware PWM modules
Replies: 16
Views: 80861

Re: HPWM/HPWM2/HPWM3 hardware PWM modules

Here's another example showing two HPWM modules sharing the same TMR // HPWM/HPWM2 sharing a single TMR device = 18F26K22 clock = 64 include "intosc.bas" #option DIGITALIO_INIT = true include "setdigitalio.bas" #option HPWM_CCP = 1 #option HPWM_TMR = 2 #option HPWM_PIN = PORTC.2 include "hpwm.bas" #...
by Jerry Messina
Wed Apr 26, 2023 12:56 pm
Forum: Modules
Topic: HPWM/HPWM2/HPWM3 hardware PWM modules
Replies: 16
Views: 80861

HPWM/HPWM2/HPWM3 hardware PWM modules

Here's a set of new hardware PWM modules (HPWM/HPWM2/HPWM3) that expand on David's original PWM.bas module, with new features and capabilities. The modules can be used alone or together to provide up to three channels of independent PWM (if your device supports it). Among some of the new features ar...
by Jerry Messina
Fri Apr 21, 2023 11:58 am
Forum: Modules
Topic: SPI2xv and 18F37Q84
Replies: 4
Views: 1860

Re: SPI2xv and 18F37Q84

SPIxv.bas uses SPI1 and SPI2xv.bas uses SPI2, so to use SPI1 instead of SPI2 you need to: - change the include to use the SPIxv.bas module - change all of the 'SPI2' references to 'SPI' in ds1394.bas - change InitPPS to map SPI1 ds1394.bas (using SPI1) Module DS1394 Include "SPIxv.bas" Include "USAR...
by Jerry Messina
Thu Apr 20, 2023 3:23 pm
Forum: Modules
Topic: SPI2xv and 18F37Q84
Replies: 4
Views: 1860

Re: SPI2xv and 18F37Q84

Also, if you make the structure definitions public you can get rid of all the references to the uart. That way the module is less dependent on other modules and the only thing ds1394 needs to include is the spi2xv.bas file. You could then use it in programs without the uart module, or use another ua...
by Jerry Messina
Thu Apr 20, 2023 12:50 pm
Forum: Modules
Topic: automatically calling SetAllDigital
Replies: 0
Views: 10066

automatically calling SetAllDigital

Devices that have shared analog/digital IO pins power up with the pins set to analog mode. This can cause various issues since pins set to analog will always read as a '0', so it's typical to include setdigitalio.bas and call SetAllDigital at startup to set all the pins to digital mode. device = 18F...
by Jerry Messina
Thu Apr 20, 2023 12:10 pm
Forum: Modules
Topic: SPI2xv and 18F37Q84
Replies: 4
Views: 1860

Re: SPI2xv and 18F37Q84

I don't think the PPS assignments are being used as intended... you keep setting them in various subs, and the lock/unlock isn't correct. The pps.bas file shows how to unlock and lock the pps peripheral and will also handle the PPS1WAY config setting. I would also recommend moving all the hardware a...
by Jerry Messina
Mon Apr 17, 2023 10:46 am
Forum: General
Topic: How To Convert Another Basic To SF
Replies: 2
Views: 1311

Re: How To Convert Another Basic To SF

Do you have a particular question or are you asking someone to re-write the entire program for you?
by Jerry Messina
Sat Apr 15, 2023 12:34 pm
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12925

Re: PIC18F2550 Configuration

If you need the three outputs to be independent there are a number of 18F devices with more than 2 CCP modules. Probably the easiest to work with is the 18F2xK22. That one has 3 ECCP and 2 CCP modules. There are some examples of using a TMR+CCP module to generate PWM on the user module wiki page, bu...
by Jerry Messina
Thu Apr 13, 2023 9:24 pm
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12925

Re: PIC18F2550 Configuration

In order to get exactly 38000Hz I think you'd have to have a clock that's a multiple of 4.864MHz.

With that, you could use the CCP/ECCP peripherals in PWM mode to get 38000 and 19000 and still do other things with the pic.
by Jerry Messina
Thu Apr 13, 2023 2:25 pm
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12925

Re: PIC18F2550 Configuration

so I tried to changes some PORTB I/O to get half value with both other PORTB, now looks more better but still need to reduce little smaller Sorry, but I don't understand what you need. What does "half value with both other PORTB" mean? Can you explain what you are looking for any better? What are t...