Like I implied in the first post, I have been using the asynchronous stimulus combined with stopwatch and register watch to get most of the program working.
But, I have been messing with the clock stimulus since my early post this morning and can't get it to work. Left alone, nothing seems to happen. When I hit the "apply" button while in Run or Halt , I get the error, "Failed to send synchronous stimulus to simulator." When I apply it during Animation, I don't get the error, but nothing happens on the watch registers. They are set to update continuously, but even when halting, there are no changes. With asychronous stimulus, the registers behave as expected.
I know the program works in part with a real chip. I was capturing and printing to an LCD nice counts for the high and low periods of a PWM signal. I then added a math routine from PicList to calculate duty cycle. It compiles, and I can get the program counter in Animate to go right through as I expected. Data output to the LCD is not what I expected, so I wanted to look at the registers used in the calculation, particularly the one used for remainder, to see what's going on.
Anyway, Google found some hits. One from Microchip was particularly informational .
It said that the clock stimulus can be tricky to set up (surprise) and referred to a Webinar on the subject. That Webinar has been removed by Microchip.
I started a new workbook just to have a good reference point. GP1 (aka Data_Y) is the input. Chip is 12F683. Assembly language. Timer1 is used, and data are collected as 16 bit in H and L registers.
The Clock Stimulus is set up just like 3v0 described. Cycle is 5000 for both high and low. Initial is high, begin at start , end never. Optional label = Data_PWM which is not used anywhere in the program.
Do I need to do anything under Pin/Register Actions? I added a GP1 signal, but that didn't help.
Are any other steps needed?
Here is a snippet of the timer/count code (sorry for the formatting that gets a little messed up between computers):
Code:
Data_start
btfsc Data_Y ;check if low
goto $-1 ;keep checking
btfss Data_Y
goto $-1 ;wait for first high
bsf T1CON,0 ;start Timer1
btfsc Data_Y ;check for low
goto $-1 ;keep checking
bcf T1Con,0 ;stop timer to read H_count
movf TMR1H,w ;IF NEEDED: add counts equivalet to 5 fosc/4
movwf H_ctrH ;to T_ctrL, add count = 5/prescale value
movf TMR1L,w ;
movwf H_ctrL ;
bsf T1Con,0 ;start timer
btfss Data_Y ;add low to timed period
goto $-1 ;keep checking
bcf T1CON,0 ;stop Timer1
John