完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在使用PIC16F86&AMP做16行X 32列矩阵设计,显示多路复用是在ISR中完成的。在1ms的速率下,我进入ISR&在每一个中断上更新每一行。对于一帧,它将需要1ms×16=16ms。我需要在显示和显示上显示移动模式,因为我需要生成延迟例程(在主代码中)。目前我只使用延迟环码使用延迟。问题是,当模式移动时,我看到一点闪烁的东西(也就是说,如果我移动一个像素,就像两个像素移动一样)。我需要使用帧而不是延迟环来生成延迟吗?
以上来自于百度翻译 以下为原文 I’m doing a 16 row X 32 column matrix design using PIC16F886 & the display multiplexing is done in the ISR. At 1mS rate I’m getting into the ISR & update each row on every interrupt. For a frame it will take 1mS X 16 = 16mS. I need to show moving patterns on the display & for that I need to generate delay routines (In the main code). For the time being I use delays using just delay loop codes. The problem is, I see a very little flicker thing when the patterns moving (That means if I move a single pixel I see like two pixels moving). Do I need to generate delays using frames instead of just delay loops? |
|
相关推荐
7个回答
|
|
这是62.5Hz,应该能很好地工作。我认为比30Hz快的任何东西都应该看起来不错。是的,我建议你为延迟来计数帧,这比延迟环更精确。我不明白你所说的“当模式移动时非常闪烁的东西”是什么意思。是好还是坏?如果你想避免伪像,可以实现两个帧缓冲器,并交替显示和编辑哪一个。这意味着在下一个完整的帧被显示之前,任何改变都不会影响输出。(也可能在SWA之后很快完成动画。PS缓冲区以确保在下一次交换之前完成所有这些操作。
以上来自于百度翻译 以下为原文 That's 62.5Hz, which should work well. I think anything quicker than 30Hz should look ok. Yes, I recommend you count frames for your delays, that would be more accurate than delay loops. I don't understand what you mean by "very little flicker thing when the patterns moving". Is that good or bad? If you want to avoid artifacts, it could be an idea to implement two frame buffers, and alternate which one you are displaying and editing. That would mean that any changes wouldn't affect the output until the next complete frame is displayed. (You may also have to do your animation soon after it swaps buffers to make sure you do it all before the next swap.) |
|
|
|
精彩建议双缓冲的东西。你明白了我的意思。如果我做动画,让我把一个像素从右向左移动,我看到两个像素在移动。*它可能是移位延迟太高(对于缓慢的延迟没有问题)。*可能是ISR显示,而我是半个标记的移位循环。*可能是DE。Read不与显示刷新率等同步。对于静态图像,这不会发生,只有快速移动时才会发生。它不是重像。我不知道这个意思:(这是件坏事。我需要平稳地转移。
以上来自于百度翻译 以下为原文 Wonderful suggestion the double buffer thing. You got it what I mean.If I do an animation, let say I move a single pixel from right to left, I see two pixels while moving. *It might be the shifting delay is too high (for slow delays there is no problem). *It may be the ISR displaying while I'm half way mark in the shifting loop. *It may be the delay is not synchronized with the display refresh rate etc... *For still images this won't happen & it happens only when shifting speedily. Its not ghosting. I don't know the meaning Artifact :( Its a bad thing.I need to shift smoothly. |
|
|
|
|
|
|
|
我通过分配另一个64字节RAM位置来实现双缓冲区。现在我有两个缓冲器,一个是工作缓冲器,另一个是显示缓冲器。更新每个帧的显示缓冲区结束。这是1ms中断x 16行=16ms。所以对于每一帧,我更新我的显示缓冲器。测试结果,如果我移动一个像素@ 16ms速率。它的速度太快,我看不到有多少个LED移动。如果我移动一个像素@ 32毫秒速率(2帧速率),我看到两个LED轻微移动。如果我移动一个像素@ 48毫秒速率(3帧速率),我看到三个LED轻微移动。如果我移动一个像素@ 64毫秒速率(4帧速率),我看到四个LED移动SLY。只有移动时才会发生这种情况。如果我使用了一个缓冲区,那么上面的情况会发生什么?在动画延迟结束后更新显示缓冲区怎么样?这意味着,如果我想要一个动画延迟为64毫秒(4帧),我不会更新显示缓冲区直到4帧超过。
以上来自于百度翻译 以下为原文 I implemented a double buffer by assigning another 64bytes RAM locations. Now I have two buffers one is working buffer & the other is display buffer. I update my display buffer end of the each frame. That is 1mS interrupt X 16 rows = 16mS. So for every single frame I update my display buffer. Tested results, If I move a single pixel @ 16mS rate. It’s too speed I cannot see how many LEDs moving. If I move a single pixel @ 32mS rate (2frames rate) I see two leds moving slightly. If I move a single pixel @ 48mS rate (3frames rate) I see three leds moving slightly. If I move a single pixel @ 64mS rate (4frames rate) I see four leds moving slightly. This happens only when moving. The above happens if I used a single buffer as well. What about updating the display buffer after expiring the animation delay? That means If I want an animation delay of 64mS (4 frames) I won’t update display buffer until 4frames exceed. Is that method ok instead of a fixed single frame display update? |
|
|
|
我们能看到你的代码吗?现在你是双缓冲,我怀疑这是你的代码中的一个bug,如果你能看到两个LED。
以上来自于百度翻译 以下为原文 Can we see your code? Now you're double buffering, I suspect it's a bug in your code if you can see two LEDs on. |
|
|
|
在这里,我完全确定这不是一个代码问题,但这是我多年来错过的一个时机。
以上来自于百度翻译 以下为原文 Here it is.I'm completely sure it is not a code issue but its a timing thing which I was missing over the years :( ;OSC = 4MHz ;Interrupt rate = 250 X 4 = 1mS ;Frame Time = 1mS X 16 = 16mS ISR_Mux bcf PIR1,TMR2IF ; clear TMR2 interrupt flag bit movlw .29 movwf Col_Counter bsf STATUS,IRP ; point to display buffer (bank3) movlw 68h movwf FSR ; incf Row,F bcf Row,4 movf Row,W addwf PCL,F goto Do_Row_1 goto Do_Row_2 goto Do_Row_3 goto Do_Row_4 goto Do_Row_5 goto Do_Row_6 goto Do_Row_7 goto Do_Row_8 goto Do_Row_9 goto Do_Row_10 goto Do_Row_11 goto Do_Row_12 goto Do_Row_13 goto Do_Row_14 goto Do_Row_15 goto Do_Row_16 Do_Row_1 movlw .2 Feed_Row_1 bcf SR_Data btfsc INDF,0 bsf SR_Data bsf SR_Clock bcf SR_Clock subwf FSR,F decfsz Col_Counter,F goto Feed_Row_1 bsf PORTC,1 ; turn off 595 (turn off display) bsf PORTC,6 ; disable previous Row bcf PORTA,0 ; enable new Row goto DO_Make_Latch Do_Row_2 --- Do_Row_3 --- Do_Row_4 --- Do_Row_16 movlw .2 incf FSR,F Feed_Row_16 bcf SR_Data btfsc INDF,7 bsf SR_Data bsf SR_Clock bcf SR_Clock subwf FSR,F decfsz Col_Counter,F goto Feed_Row_16 bsf PORTC,1 ; turn off 595 (turn off display) bsf PORTC,7 ; disable previous Row bcf PORTC,6 ; enable new Row ; bsf Flag_Register,End_Frame ;copy working buffer to display buffer @ end of frame (16mS) Copy_Buffer bcf STATUS,IRP ; point to working buffer on (Bank0) movlw 30h movwf FSR movlw .29 movwf Counter ; Copy_Loop movf INDF,W bsf STATUS,IRP movwf INDF bcf STATUS,IRP incf FSR,F movf INDF,W bsf STATUS,IRP movwf INDF bcf STATUS,IRP incf FSR,F decfsz Counter,F goto Copy_Loop ; DO_Make_Latch nop nop nop nop bsf SR_Latch ; LATCH low to high transition nop ; tied both SR Latches bcf SR_Latch ; // bcf PORTC,1 bcf STATUS,IRP ;point to working buffer ISR_Exit --- ;========================================================== Main_Loop movlw .7 movwf Shift_Count Shift_Init movlw b'00000001' ; load a pixel to working buffers movwf 30h movwf 32h movwf 34h movwf 36h movwf 38h movwf 3Ah ; Shift_Loop bcf STATUS,C rlf 30h,F rlf 32h,F rlf 34h,F rlf 36h,F rlf 38h,F rlf 3Ah,F bsf PCLATH,3 call Delay_64mS bcf PCLATH,3 decfsz Shift_Count,F goto Shift_Loop movlw .7 movwf Shift_Count goto Shift_Init ;--------------------------------------------------------- org 0x0B00 Delay_64mS movlw .4 movwf Del_Count ; 4 X 16mS = 64mS bcf Flag_Register,End_Frame Del_Loop btfss Flag_Register,End_Frame goto $-1 bcf Flag_Register,End_Frame decfsz Del_Count,F goto Del_Loop return |
|
|
|
这是相当困难的,当你不张贴整个事情,并没有真正记录你所遗漏。
以上来自于百度翻译 以下为原文 that's fairly hard to follow when you don't post the whole thing and don't really document what you've left out. |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3217 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
786浏览 1评论
677浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
603浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
684浏览 0评论
581浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 04:38 , Processed in 1.419740 second(s), Total 90, Slave 74 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号