Search found 1471 matches

by Jerry Messina
Thu Apr 13, 2023 9:24 pm
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12945

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: 12945

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...
by Jerry Messina
Thu Apr 13, 2023 11:31 am
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12945

Re: PIC18F2550 Configuration

As you can see, almost I reach the point, only the PORTB6 on a top picture I need to reduce to reach till half value refer to PORTB0 and PORTB1, can you please help, what is should I change to reach half value than both PORTB0 and PORTB1. I'm sorry, but I don't understand the question. I don't use ...
by Jerry Messina
Wed Apr 12, 2023 11:24 am
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12945

Re: PIC18F2550 Configuration

'SetAllDigital()' is a subroutine call, so it has to be located after all the variables are declared Device = 18F2550 //uC use Clock = 20 // Use external crystal Config PLLDIV = 5, // Divide by 5 (20 MHz oscillator input) CPUDIV = OSC1_PLL2, // [Primary Oscillator Src: /1][96 MHz PLL Src: /2] USBDIV...
by Jerry Messina
Tue Apr 11, 2023 10:15 pm
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12945

Re: PIC18F2550 Configuration

I think your 'while' statement isn't doing what you want. While PORTB = %11111110 LATB.0 = 0 is being evaluated as While (PORTB = %11111110) LATB.0 = 0 If you want to create an infinite loop then change that to While (true) PORTB = %11111110 LATB.0 = 0 ' other statements end while You should be sure...
by Jerry Messina
Tue Apr 11, 2023 3:18 pm
Forum: User Modules
Topic: updated random number generator module
Replies: 0
Views: 10811

updated random number generator module

I created an updated version of David Eather's PseudoRandomNumberGenerator. See PseudoRandomNumberGeneratorV2 This is a single file implementation (no copying/renaming/changing code) that supports byte, word, longword, and floats. You simply select the data type of interest using #option RAND_T befo...
by Jerry Messina
Tue Apr 11, 2023 11:53 am
Forum: General
Topic: PIC18F2550 Configuration
Replies: 15
Views: 12945

Re: PIC18F2550 Configuration

It looks like you're using examples from another form of BASIC. I would read through the Swordfish language manual, but try this. At least it will compile. The issue wasn't with the config statement, it was with all the other stuff. device = 18F2550 //uC use clock = 20 // Use external crystal config...
by Jerry Messina
Mon Apr 10, 2023 1:21 pm
Forum: Modules
Topic: Question about ISRTimer
Replies: 5
Views: 1717

Re: Question about ISRTimer

You might give this a try... I took what you had and added a timeout to the capture() routine. There are some other misc changes and corrections, just look for the 'jm' comments I changed a few variable names just so I could keep track of what was going on (mostly register bit names). { ************...
by Jerry Messina
Sun Apr 09, 2023 1:33 pm
Forum: Modules
Topic: Question about ISRTimer
Replies: 5
Views: 1717

Re: Question about ISRTimer

This part here is going to cause problems: INTCON = $C0 ' Enable interupts *** Don't think I need this for the T3Gate if I am polling it **** T3_GIR = true ' Enable Timer1 Gate Mode Interupt I wouldn't recommend directly writing to the INTCON register (that's what the enable()/disable() statements a...
by Jerry Messina
Sat Apr 08, 2023 12:31 pm
Forum: Modules
Topic: Question about ISRTimer
Replies: 5
Views: 1717

Re: Question about ISRTimer

Ok, let's look at the whole 'Timer.Items(x)' part first... Each 'timer' (ie 'timer item') gets a data structure allocated to it that contains all the details for that timer // a timer item structure... structure TTimerItem Enabled as boolean Interval as TInterval OnTimer as TEvent #if TIMER_AUTO_REL...
by Jerry Messina
Tue Mar 28, 2023 6:15 pm
Forum: Announcements
Topic: Online update - 28 MAR 2023 - v2.2.4.0
Replies: 0
Views: 13094

Online update - 28 MAR 2023 - v2.2.4.0

There is a new compiler update 2.2.4.0 available for registered users. Download: http://www.mecanique-web.co.uk/downloads/swordfish-si.exe and enter your activation key to install. You can view a list of changes here: https://www.sfcompiler.co.uk/wiki/pmwiki.php?n=Swordfish.VersionHistory For the SE...
by Jerry Messina
Tue Mar 28, 2023 12:11 pm
Forum: Compiler
Topic: **IMPORTANT** Optimizations in v2.2.3.8
Replies: 4
Views: 1669

Re: **IMPORTANT** Optimizations in v2.2.3.8

check your PM. The ICC v1.2.1.0 update is a separate download for v2.2.3.8 See https://www.sfcompiler.co.uk/wiki/wiki-uploads/SwordfishUser/Modules/sf_update_3_1_2023b.zip ... which is now superseded by the 2.2.4.0 online update, which includes ICC v1.2.1.0 After performing the update to 2.2.4.0 you...
by Jerry Messina
Mon Mar 27, 2023 12:48 pm
Forum: Compiler
Topic: Interrupts and variable saving
Replies: 13
Views: 12197

Re: Interrupts and variable saving

I agree. After writing that I realized how complicated a topic it can be, especially for someone not versed in all the details of the 18F. We'll have to see if I can come up with something that helps make sense of it. Since the original question was about the usage of TABLEPTR, I added that to the a...
by Jerry Messina
Sun Mar 26, 2023 10:44 pm
Forum: Wiki Announcements
Topic: New article: Interrupt Context Saving
Replies: 0
Views: 28721

New article: Interrupt Context Saving

There's a new wiki article on Interrupt Context Saving in an ISR where I go into depth on the subject.
by Jerry Messina
Sun Mar 26, 2023 10:41 pm
Forum: Compiler
Topic: Interrupts and variable saving
Replies: 13
Views: 12197

Re: Interrupts and variable saving

I finally got around to writing something up.
See the wiki article on Interrupt context saving

I think I may try my hand at developing an app to aid in all this, sort of an "ISR Adivsor" tool...