Search found 1469 matches

by Jerry Messina
Wed Apr 13, 2011 5:18 pm
Forum: Compiler
Topic: CDC and timer interrupt
Replies: 20
Views: 12149

You don't need to mess with those registers like that. You're effecting a lot of other settings, which you may not want to do if you use a different chip. Enable() and Disable() will take care of the global interrupt enables for you as well as the IPEN bit in RCON, so all you need to do is clear INT...
by Jerry Messina
Wed Apr 13, 2011 2:54 pm
Forum: Compiler
Topic: CDC and timer interrupt
Replies: 20
Views: 12149

Interrupts on the pic default to high priority. In addition to declaring the interrupt routine as low priority, you need to change a register setting as well.

TMR0 priority is controlled with INTCON2.TMR0IP (bit 2 on the 14K50). Clear that bit to assign it to the low priority vector.
by Jerry Messina
Wed Apr 13, 2011 12:45 pm
Forum: Compiler
Topic: CDC and timer interrupt
Replies: 20
Views: 12149

A couple of questions...

- which device?

- is USB using interrupts (ie. is USB_SERVICE = true)?
If so, make sure you set the timer to use the other priority. USB_SERVICE_PRIORITY defaults to ipHigh, so the timer would normally be ipLow.

- what's the timer ISR look like?
by Jerry Messina
Thu Apr 07, 2011 5:23 pm
Forum: Compiler
Topic: Has anyone used Peripheral Pin Select to map pins?
Replies: 10
Views: 6894

In addition to running SystemConvert to get the new include files, if it helps I did a PPS module for the 46J50 a while back. It needs a few changes for the 47J13, but they're pretty similar... { //------------------------------------------------------------------------------ Name : pps.bas Author :...
by Jerry Messina
Tue Apr 05, 2011 1:41 pm
Forum: User Modules
Topic: Public Variable not visible in Module Routine
Replies: 4
Views: 3534

If you want HighTime to be visible to all three modules, a common solution is to create a "globals.bas" file and put the definition in there, and then 'include "globals.bas"' anywhere you need to. If you're coming to SF from other flavors of BASIC, the visibility rules take a little getting used to....
by Jerry Messina
Tue Apr 05, 2011 1:24 pm
Forum: User Modules
Topic: Brown Out Detection
Replies: 8
Views: 6000

There's a couple of different ways to access the bits. If you poke around, you'll find a number of them. Here's a summary of a few... #define method = 4 #if (method = 1) // method 1 // absolute bit reference RCON.0 = 1 #elseif (method = 2) // method 2 // bit alias dim BOR as RCON.0 BOR = 1 #elseif (...
by Jerry Messina
Mon Apr 04, 2011 8:49 pm
Forum: User Modules
Topic: Brown Out Detection
Replies: 8
Views: 6000

Sorry 'bout that. Just an illustration.

The easiest way is probably just to define aliases...

dim BOR as RCON.0,
POR as RCON.1

BOR = 1
POR = 0

There's a few other ways as well, such as defining a structure of the register layout.
by Jerry Messina
Mon Apr 04, 2011 1:14 pm
Forum: User Modules
Topic: Brown Out Detection
Replies: 8
Views: 6000

Those statements are a bit confusing, at least to me. You're right... once you detect one of the events you should set the bit so you can detect future events next time. If you look at Table 5-1 (and the other paragraphs in that section), you'll see that the only event that sets all the RCON bits to...
by Jerry Messina
Mon Apr 04, 2011 9:39 am
Forum: User Modules
Topic: Brown Out Detection
Replies: 8
Views: 6000

I think you're misinterpreting the brownout function. If you enable the BOR in the config settings, then when a brownout event occurs the processor will automatically reset. You don't have to do anything else. You can check the bits in RCON at the start of your program to see if any of the various r...
by Jerry Messina
Wed Mar 30, 2011 11:21 am
Forum: Compiler
Topic: MPLAB 8.66/MPASM 5.40 released
Replies: 1
Views: 2362

MPLAB 8.66/MPASM 5.40 released

FYI - There's an update to MPLAB available (8.66) that includes the new MPASM 5.40 assembler. There's nothing really new in this version that I can tell... a few more devices now have the DEBUG bit exposed in the CONFIG word. No new 18F devices from what I see over what was in 8.63. There is an issu...
by Jerry Messina
Tue Mar 29, 2011 9:12 am
Forum: User Modules
Topic: Im using SetBaudrate(br2400) but getting 9600?
Replies: 5
Views: 3620

Tony, If you're using an external 48MHz clock, you'd be better off changing to "Config FOSC = EC". I don't think you need to change the other options/registers to run w/an external clock... it looks like they default ok. You'd only need to set them up if you had to enable the PLL and dividers. But, ...
by Jerry Messina
Mon Mar 28, 2011 7:54 pm
Forum: User Modules
Topic: How to generate 10KHz to 200KHz with 18F87J50 ?
Replies: 3
Views: 2830

I'm curious... how did you end up getting 1KHz steps?
by Jerry Messina
Mon Mar 28, 2011 7:41 pm
Forum: User Modules
Topic: Im using SetBaudrate(br2400) but getting 9600?
Replies: 5
Views: 3620

Keep in mind that the "clock = " statement doesn't actually setup anything hardware-wise... it's purely so the compiler can know what speed you're running at so it can adjust software delays, timers, etc. You have to setup the CONFIG and OSCONx/OSCTUNE registers yourself, however, to actually get th...
by Jerry Messina
Sun Mar 27, 2011 10:30 am
Forum: Compiler
Topic: K22 ASM errors
Replies: 13
Views: 7902

The release notes say that it is bundled with MPASM V5.38. The release notes lie. It's not the first time... you can't trust them. MPLAB 8.66 includes MPASM V5.40. At least you've got the right stuff. You have two choices: - copy the required files from the Microchip/MPASM Suite directory into the ...
by Jerry Messina
Sun Mar 27, 2011 8:58 am
Forum: Compiler
Topic: K22 ASM errors
Replies: 13
Views: 7902

I get that set of errors using MPASM V5.22, which is very old. To support the K22, you'll need a more recent version... at least MPASM V5.34, but a later version would be better, like 5.37.

MPLAB is up to V8.66, which includes MPASM V5.40.