Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - internal oscillator frequency is too low for 8 digit control how to increase ?

(you are viewing a thread; or go back to list of threads)

internal oscillator frequency is too low for 8 digit control how to increase ? (by mfq)
internal oscillator frequency is too low for 8 digit control
how to increase ?
at 7 segment with 8 digit have problem is that fluctuation in every one segment
ANY PIC16f8XXA is not working well at 20Mhz cycle time 0.2ms

if i decrease cycle time 0.1ms atter that compile at problem give massage increase your mcu crystal

*************************************************************
massage cycle time too fast:increase cycle time,or use faster crystal
*************************************************************
20Mhz 0.1ms in problem above massage
20Mhz 0.2ms fluctuation
Sat May 11 2013, 14:03:04
(no subject) (by David R)
it sounds like you are expecting to much from the chip!

Try atmel I think that will go .1ms ? but not with much code

Regards
David
Sun May 12 2013, 05:54:24
(no subject) (by MGP)
It is not the chip but the cycle time ;-)

According to my experience, the maximum is 5 digits even with 0.1ms cycle time.
With 5 digits you see also fluctuation, but less.

So, Atmel or Pic is irrelevant.
Mon May 13 2013, 08:17:45
bcd to led display (by labozidar)
Why don't You use bcd control for each digit or LCD display.
Tue May 14 2013, 08:11:38
(no subject) (by charly)
can you share the code for testing it?
Tue May 14 2013, 14:25:11
(no subject) (by MGP)
While testing >2years ago I took some foto's.
16F876a/20Mhz/0.4 cycle time.

The program included arithmetic operations, but i erased it after testing.

It's a low resolution picture and shows the shadows of a 4 digit version and never got it right.

Maybe can mfq upload his version for you.
Tue May 14 2013, 15:36:58, download attachment P1000254.JPG
MPG & DAVID R THANKS TO RESPONSE (by MFQ)
THANKS MGP TO RECOMMEND ME

I WANT TO USE MINIMUM PINS FROM MCU & MINIMUM COMPONENT FOR CIRCUITS

I HAVE ATTACHED DRAWING

FIRST STEP FOR DISPLAY 8 DIGIT
(WITH MINIMUM PINS AND COMPONENT)

SECOND STEP CONTINUE....
Wed May 15 2013, 00:51:14, download attachment 8DMC.pdf
(no subject) (by MGP)
I was also looking for a display like that, and convert that to RS232 -> (8)digit, but ldmicro has its limitations and speed (cycle time) is one of them.

But it's a plc program and i love that programming language.
Wed May 15 2013, 04:10:03
(no subject) (by charly)
The conversion from binary to bcd takes approx 14 cycles per bit, so 24 bit = 336 or 2x 16bit = 500 clocks approx, always
instruction clock.
I have noted that you donīt use HW SPI.
Sending out data in sw takes 30 cycles x 8 = 240 cycles.
Internal osc is 4 Mhz so 1000 cycles is 1ms.
If you update the display 20 times per second (really fast),
then itīs 50 ms between update.

Assuming you have a time cycle of 1ms, and give full 50-120mA
to every segment for 100ĩS for full intensity, itīs the normal
way of doing it, but not using youīr circuit.
Circuit likes youīr, itīs easyer to use one shift register
for every display, mount it under or on back of the displays
and have 4 pins connected to leds anode and 4 pins to leds
cathode (using 4x common anode and 4x common cathode) limited
to 17,5mA approx for each led in order to donīt out of specs. Why you donīt use a led driver, the
cost ist not so far off and it have the advantage to allow
increasing the current to 15mA average, example SCT2168CSOG, but it depends on youīr supplier what type of brands it have.

If you want, i can integrate a interrupt module for pic,
that does code inside interrupt, limited to whole ports,
that takes a blob of hex code. Example can be lcd, led.
This need to be hand coded and not ladder generated even if
this could be possible with some limitations.

Pls share the code for the ladder.
Wed May 15 2013, 08:48:31
(no subject) (by charly)
BTW, massage cycle time too fast:increase cycle time,or use faster crystal massage means:
the timing donīt fit inside 16bit value.
I donīt know what is the part of the ladder design that limits
the cycle time, i gave one generic example:

If you have a timer of 10 second,
and use 0.2ms cycle time, then it fits inside 16bit,
because 10 seconds or 10000ms / 0.2ms = 50000 and this fits
inside 16 bit. 0.1ms goes out of range, but 0.15ms are in range,
10000/65535=0,15259ms for the calc.

If you need 0.1ms cycle time, then split the 10 seconds timer
to two 5 seconds timers, and it will work, one single timer
can go up to 6.5 seconds approx, exactly 6552.5ms.
Wed May 15 2013, 09:31:41
(no subject) (by charly)
Sorry, cycle time is hardcoded to emit a error if less then
1ms on 4Mhz OSC or 0.2ms on 20Mhz OSC.
Without recompiling, you need to increase the OSC frequence and
half the timings in order to trick out the ladder logic.
Wed May 15 2013, 13:41:43
Samples (by labozidar)
This are samples from Jonathan which he send me years ago i You can find what You need.
Thu May 16 2013, 02:21:45, download attachment Samples.zip
(no subject) (by charly)
Based on the 7seg-displays it should work without problems on
8 displays. The only problem that can be is if there are many
division/multiplication or other time consuming task.

The startup code:
org 0
bcf 0xa, 0x3
bcf 0xa, 0x4
goto 0x8
nop
nop
nop
nop
nop
--> code start here

It could be changed to this without recompiling any ldmicro.exe

org 0
bsf INTCON,GIE ; enable interrupts
goto 0x8
int_: nop ; or one of this depending of programcode ending => bsf PCLATH,3 -- bsf PCLATH,4 -- decfsz PCLATH
goto interrupt
int: movwf save_w ; must be inside shared ram bank
swapf pclath,w ; save PCLATH
clrf pclath ;
goto int_

and at the end of the code, add interrupt code.
on the beginning of ladder, make
----- move display2 display2 ---
----- move display2 display2 ---

in order to allocate two variables, that can be addressed
from interrupt code. The other condition is, that ram
in shared memory is free. If not too many variables are
used, then it works. Otherwise ldmicro can be configured to
reserve this and maybe other variables for interrupt processing.

Basically, it should be added in LDMICRO how many time itīs
takes to compute one cycle. This time is fixed and need only
minor changes to the asm compiling code in order to get out
this important value.

If you have gputils installed, than i can write something
that add interrupt code to compiled ldmicro files based on
asm source files that you specify as argument.

This can be modbus, simulated rs232, lcd display, leds, ...
There is hovever one implication, if you share the port used
on interrupt with ladder code, the remaining pins should be
inputs, otherwise Read-Modify-Write problem persist.

Annother possible problem that i have seen is division/multiplication subroutine. This are placed after
main program. This is strange, because pic uC can call only subprogramms, that are inside half of the paging size and because this, itīs really likely possible that instead of calling the mul/div code, other code is called.

Tell me if i should write such a program for pic mcu that does
interrupt processing and give me some example what it should do, for making some sample code.
Thu May 16 2013, 08:20:08
(no subject) (by charly)
actually a hack, but works very well.
decompile the hex using gpasm -s
use x.exe x.dis int.asm > x.asm
compile it with gpasm
x.exe -vprescaler=1 x.dis int.asm >x.asm
set the prescaler of inside option to value 4
Timer0 is used for interrupt processing,
if no init is necessary, the first opcode should be nop,
otherwise a goto int_skip , the init code that is executed after
after timeout of 65ms on 1Mhz instruction clock , and the label
int_skip
Thu May 16 2013, 12:30:42, download attachment x.zip
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):